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.
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)
It might be that I'm misunderstanding your responses, but aren't
you testing if there is a difference between the two full models?
What I want to know, os whether the effect of a specific predictor
(x) differs between model1 and model2. I'm not interested (presently)
if the fit of model 2 is better than that of model 1 (for instance).
On Jan 22, 2007, at 16:26 , Kuhn, Max wrote:
> You can use the anova function a la:
>> anova(model1, model2)
> Analysis of Variance Table
> Model 1: y ~ x
> Model 2: y ~ x + z
> Res.Df RSS Df Sum of Sq F Pr(>F)
> 1 13 4.4947
> 2 12 4.4228 1 0.0720 0.1952 0.6665
> I would suggest getting a copy of MASS and/or reading
> http://www.stats.ox.ac.uk/pub/MASS3/Exegeses.pdf >
> LEGAL NOTICE
> Unless expressly stated otherwise, this message is confidential and
> may be privileged. It is intended for the addressee(s) only.
> Access to this E-mail by anyone else is unauthorized. If you are
> not an addressee, any disclosure or copying of the contents of this
> E-mail or any action taken (or not taken) in reliance on it is
> unauthorized and may be unlawful. If you are not an addressee,
> please inform the sender immediately.