[R] Compare effects between lm-models

From: Rense Nieuwenhuis <r.nieuwenhuis_at_student.ru.nl>
Date: Mon 22 Jan 2007 - 15:16:05 GMT

Dear helpeRs,

I'm estimating a series of linear models (using lm) in which in every new model variables are added. I want to test to what degree the new variables can explain the effects of the variables already present in the models. In order to do that, I simply observe wether these effects decrease in strength and / or lose their significance.

My question is: does any of you know a package / function in R that can test whether these changes in effects between models are significant? I figure these effects follow a T-distribution and I know the std. devs., so it must be easy to do manually. But I would like not to invent the wheel, when the function is already present.

Below is an example of what I mean. In model2, the variable z is added, which is hypothesized to partly explain the effect of x. Indeed, the effect of x decreases in model2, compared to model1. What I want to find out, is if this decrease is statistically significant.

Many thanks,


x <- c(1,1,1,1,1,2,2,2,2,2,3,4,4,4,5)
z <- c(2,2,2,2,2,2,2,2,3,3,3,3,4,4,5)
y <- c(1,2,2,2,3,3,3,3,4,4,4,5,5,5,5)

model1 <- lm(y~x)
model2 <- lm(y~x+z)

        [[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue Jan 23 02:23:19 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 22 Jan 2007 - 16:30:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.