[R] planned comparisons for ANOVA

From: Darren Weber <darrenleeweber_at_gmail.com>
Date: Mon 17 Jul 2006 - 14:23:17 EST


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


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.

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Jul 17 14:27:26 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 17 Jul 2006 - 16:14:29 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.