Skip to content
Prev 67098 / 398506 Next

Help with three-way anova

Hi John

Thanks for your help, that was a very clear answer.  It looks as though,
due to my design, the best way forward is:
[,1]
I    -1
UI    1
[,1]
UV   -1
V     1
Thanks
Mick

-----Original Message-----
From: John Fox [mailto:jfox at mcmaster.ca] 
Sent: 06 April 2005 12:52
To: michael watson (IAH-C)
Cc: 'r-help'; f.calboli at imperial.ac.uk
Subject: RE: [R] 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 
--------------------------------