[R] model formulation for the following ANOVA

Richard M. Heiberger rmh at temple.edu
Thu May 11 21:47:06 CEST 2006

Please use better spacing to improve legibility.

roi.aov <- aov(mean ~ cond*roi*group + Error(subj/(cond*roi)),

The +group you had is redundant.  It is implied by  cond*roi*group.
You can verify this by typing

Based on the df in tha ANOVA table, it looks like roi is a factor.
There are only two levels of group and cond, so 1 df doesn't clearly
distinguish whether you made them factors.

You didn't give the SAS statement, so I am guessing here.
SAS tests everything against the within residuals unless you
specifically give some test statements.  Further, it doesn't separate
out the residuals at the various strata unless you tell it to.
In a repeated measures design you do not want the default tests,
you will need to specify the tests you have in mind.

The Error() function determines the tests by looking at the linear
dependencies among the subspaces implied by the factors.

Based on your description of this as a repeated measures design, the
ANOVA you have with the this R statement better matches the design than
the equivalent statement

roi.aov <- aov(mean ~ cond*roi*group,

which I am guessing is the match to the SAS statement you used.  This statement
does not isolate the various strata residuals.

More information about the R-help mailing list