Skip to content
Prev 67096 / 398506 Next

Help with three-way anova

Dear Mick,

For a three-way ANOVA, the difference between aov() and lm() is mostly in
the print and summary methods -- aov() calls lm() but in its summary prints
an ANOVA table rather than coefficient estimates, etc. You can get the same
ANOVA table from the object returned by lm via the anova() function. The
problem, however, is that for unbalanced data you'll get sequential sums of
squares which likely don't test hypotheses of interest to you.

If you didn't explicitly set the contrast coding, then the out-of-box
default in R [options("contrasts")] is to use treatment.contr(), which
produces dummy-coded (0/1) contrasts. In this case, the "intercept"
represents the fitted value when all of the factors are at their baseline
levels, and it's probably entirely uninteresting to test whether it is 0.

More generally, however, it seems unreasonable to try to learn how to fit
and interpret linear models in R from the help files. There's a brief
treatment in the Introduction to R manual that's distributed with R, and
many other more detailed treatments -- see
http://www.r-project.org/other-docs.html.

Regards,
 John

--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
--------------------------------
Message-ID: <20050406115222.ZCOK27737.tomts40-srv.bellnexxia.net@JohnDesktop8300>
In-Reply-To: <8975119BCD0AC5419D61A9CF1A923E950172D18B@iahce2knas1.iah.bbsrc.reserved>