[R] anova comparisons

Rolf Turner rolf.turner at xtra.co.nz
Sat Feb 23 10:06:13 CET 2013


On 02/23/2013 08:55 PM, Robert Zimbardo wrote:
> I have several linear models on the same data:
>
> m1 <- lm(y ~ poly(x,1))
> m2 <- lm(y ~ poly(x,2))
> m3 <- lm(y ~ poly(x,3))
>
> What I don't understand is why
>
> anova(m1, m2, m3, test="F")
>
> - yields the same RSS and SS values, but a different p-value from anova(m1,
> m2, test="F")
> - when it also yields the SAME as anova(m2, m3, test="F")
>
> What am I missing?

A basic understanding of the theory of linear models.  This really has 
little
to do with R.  Go and read a good intro to linear modelling.

Insofar as your question has anything to do with R:

When you do

     anova(m1, m2, m3, test="F")

the mean squared error from m3 is used as the denominator of the F 
statistic.

When you do

     anova(m1, m2, test="F")

the mean squared error from m2 is used as the denominator of the F 
statistic.

     cheers,

         Rolf Turner



More information about the R-help mailing list