Re: [R] lm type of sums of squares

From: Liaw, Andy <andy_liaw_at_merck.com>
Date: Sat 29 Oct 2005 - 03:25:18 EST


anova.lm() gives the sequential tests:

> set.seed(1)
> dat <- data.frame(y=rnorm(10), x1=runif(10), x2=runif(10))
> anova(lm(y ~ x1 + x2, dat))


Analysis of Variance Table

Response: y

          Df Sum Sq Mean Sq F value Pr(>F)
x1         1 1.1483  1.1483  2.0943 0.1911
x2         1 0.4972  0.4972  0.9068 0.3727
Residuals  7 3.8383  0.5483               

> anova(lm(y ~ x2 + x1, dat))

Analysis of Variance Table

Response: y

          Df Sum Sq Mean Sq F value Pr(>F)
x2         1 0.5165  0.5165  0.9419 0.3641
x1         1 1.1291  1.1291  2.0592 0.1944
Residuals  7 3.8383  0.5483               

The SS, F-stat, etc. would be invariant to order only if the terms are orthogonal.

Andy

> From: Jarrett Byrnes
>
> I'm curious, I realize there are methods for Type II and III sums of
> squares, and yet, when I've been constructing models with lm, I've
> noticed that position of the term of the model has not mattered in
> terms of its p-value. Does lm use sequential Type I sums of squares,
> or something else?
>
> Thanks!
>
> -Jarrett
>
> ______________________________________________
> 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
>
>



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 Received on Sat Oct 29 03:33:52 2005

This archive was generated by hypermail 2.1.8 : Sat 29 Oct 2005 - 06:16:08 EST