[R] Help with ANOVA in R

Vokey, John vokey at uleth.ca
Wed Mar 10 18:31:42 CET 2010


> 
> Your line of code:
> 
>  zzz.aov <- aov(Intensity ~ Group + Error(Sample), data = zzzanova)
> 
> indicates that you are trying to do a repeated measures ANOVA, not just an
> ANOVA. The Error(Sample) term in your expression indicates that Sample is a
> within subjects factor, which I presume is not the case.
> The way I understood your data, the Sample column is just an id number for
> the subjects - is that right?
> 
> If you just want to compare the means of Intensity for the the four Groups,
> then just do:
> 
>  zzz.aov <- aov(Intensity ~ Group, data = zzzanova)
> 
> You may want to consult this resource for explicit examples of ANOVA in R:
> 
>  http://www.personality-project.org/R/r.anova.html
> 
> Ravi Kulkarni

No, Error(Sample) does NOT indicate a repeated-measures ANOVA.  This use of Error() is, in fact, correct for this between design, and labels the error partition, although not doing so will still return the same result with a generic name for the error partition.  However, slightly more complicated designs (say, one between and one within factor) will *require* the Sample ID vector (as factor) to assign the partitions. [i.e., with s as the factor of IDs, and P as the repeated measure factor, and A as the between factor, then aov(dv~A*P+Error(s/P)) is the correct specification, although I prefer, and instruct my students, to expand explicitly in the aov call, what the call itself expands to: aov(dv~A+P+A:P+Error(s+s:P)), making it clear that there will be two partitions: s and s:P---s being used to test A, and s:P being used to test P and A:P].
--
Please avoid sending me Word or PowerPoint attachments.
See <http://www.gnu.org/philosophy/no-word-attachments.html>



More information about the R-help mailing list