[R] Order of terms in formula changes aov() results
Stuart Luppescu
slu at ccsr.uchicago.edu
Thu Mar 22 22:06:49 CET 2012
Hello, This one is very perplexing. I have teacher observation data,
with factors teacher ID, observer ID, component, grade and subject. When
I do this,
aov(data=ratings.prin.22, rating ~ obsid.f + tid.f + subject.f + grade.f + comp.f)
I get this:
Terms:
obsid.f tid.f grade.f comp.f Residuals
Sum of Squares 306.23399 221.38173 1.70000 14.52831 279.05780
Deg. of Freedom 74 87 2 9 1406
This looks right. There are about 82 observers so 74 degrees of freedom
for obsid.f is OK. But if I do this (just reordering the terms in the
formula):
aov(data=ratings.prin.22, rating ~ comp.f + grade.f + subject.f + tid.f + obsid.f)
I get this:
Terms:
comp.f grade.f subject.f tid.f obsid.f Residuals
Sum of Squares 15.0923 23.3968 5.9982 499.3568 0.0000 279.0578
Deg. of Freedom 9 4 4 152 3 1406
Now obsid.f only has 3 degrees of freedom and the sum of squares is
0.00. Could this be due to the unbalanced design?
If someone can explain this to me I would be very grateful.
--
Stuart Luppescu -=- slu .at. ccsr.uchicago.edu
University of Chicago -=- CCSR
才文と智奈美の父 -=- Kernel 3.2.1-gentoo-r2
Tony Plate: There looks to be a typo in the R-exts
manual: [...] Peter Dalgaard: 'svn blame' tells me
that this was Brian's addition in rev.35362 [...]
Brian D. Ripley: I prefer 'svn praise' myself.
Peter Dalgaard: Or 'svn annotate'. I think it
depends on what I'm looking for, plus the risk
that the author (perpetrator, contributor) might
be me... -- Tony Plate, Peter Dalgaard and
Brian D. Ripley (about a typo in the
More information about the R-help
mailing list