[R] Compare effects between lm-models

Rense Nieuwenhuis r.nieuwenhuis at student.ru.nl
Mon Jan 22 17:36:02 CET 2007


Thank you Alain and Max for your swift responses.

  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).

thanks again,

Rense




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
>
>
> Max
>
>
>
> ----------------------------------------------------------------------
> 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.
>



More information about the R-help mailing list