Darren Weber wrote: [snip] > 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? > There are a couple of ways to do this in R. Perhaps the easiest is to use make.contrasts in the gmodels package.
cmat <- rbind("S1 v S2" = c(1, -1, 0), "S2 v S3" = c(0, 1, -1)) library(gmodels) fit <- aov( Y ~ Task*Hemisphere*Group + Error( Subject/(Task*Hemisphere), contrasts=list("Task"=make.contrasts(cmat ))) summary(fit) > Alternatively, is there a function to compute the planned comparisons > after running the full ANOVA model? > see ?fit.contrast in gmodels for this. HTH, Simon. > 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 > > -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C ______________________________________________ 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