[R] planned comparisons for ANOVA

Darren Weber darrenleeweber at gmail.com
Mon Jul 17 06:23:17 CEST 2006


Hi,

we need some help to define planned comparisons.  I've based my
understanding of the problem on reading Tabachnick and Fidell (2006),
ie:

http://www.ablongman.com/catalog/academic/product/0,1144,0205459382,00.html

I don't understand how to specify planned comparisons in R.  I've not
found explanations for this in MASS or elsewhere.  There is only
discussion of the contrast option to ANOVA in general terms, there are
no examples for the analysis of planned comparisons.

I have an ANOVA design, described as a factorial design, with both
between-subjects and within-subjects factors.  There are 2 subject
groups.  Although there are matched individuals across groups (matched
for extraneous demographic variables), we consider them a
between-subject factor with 2 categorical levels (controls, patients).
 The dependent variable is a multivariate recording from 124
electrodes on the scalp, to measure electric potential from the scalp
surface.  These recordings are summarised into regional activity for
the left and right hemisphere.   So hemisphere is a within-subjects
factor that has 2 levels (left and right).  The last factor is an
experimental manipulation, a visual task contains three types of
events.  This is a  within-subjects factor with three levels (S1, S2,
S3).

Our planned comparisons are:

1. test the group mean difference for S1 vs S2 (in the absence of S3)
2. test the group mean difference for S2 vs S3 (in the absence of S1)

This is the current form of the ANOVA specification for R:

aov( Y ~ (Task*Hemisphere*Group) +
                Error( Subject/(Task*Hemisphere) )

How can we add planned comparisons to this specification?  Can we add
just one planned comparison matrix, with rows for 1 & 2 above, or do
we need to run the model twice, once for each planned comparison?
Alternatively, is there a function  to compute the planned comparisons
after running the full ANOVA model?

Thanks, Darren

PS, I was trained well on using SPSS, but I am trying to make a switch
to R.  You help with this would be really appreciated.  We need to get
our results revised and published soon.



More information about the R-help mailing list