[R] lm type of sums of squares
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
Re: [R] lm type of sums of squares
Dear Jarrett, anova() gives sequential sums of squares (as ?anova.lm says). See Anova() in the car package for something similar to Type II and III sums of squares. I hope this helps, John On Fri, 28 Oct 2005 10:05:39 -0700 Jarrett Byrnes [EMAIL PROTECTED] wrote: 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 John Fox Department of Sociology McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox/ __ 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
Re: [R] lm type of sums of squares
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