Hello everyone, I am trying to run a repeated measures Anova in R followed by some specific contrasts on that dataset. So far I think the correct approach would be to use Anova() from the car package. Â Lets illustrate my question with the example taken from ?Anova using the OBrienKaiser data: We have a design with 2 between subjects factor, treatment (3 levels: control, A, B) and gender (M vs. F), and 2 repeated-measures (within subjects) factors, phase (3 levels: pretest, posttest, followup) and hour (5 levels: 1 to 5).
The standard ANOVA table is given by (in difference to example(Anova) I switched to Type 3 Sums of Squares, that is what my field wants): require(car) phase <- factor(rep(c("pretest", "posttest", "followup"), c(5, 5, 5)), levels=c("pretest", "posttest", "followup")) hour <- ordered(rep(1:5, 3)) idata <- data.frame(phase, hour) mod.ok <- lm(cbind(pre.1, pre.2, pre.3, pre.4, pre.5, post.1, post.2, post.3, post.4, post.5, fup.1, fup.2, fup.3, fup.4, fup.5) ~ treatment*gender, data=OBrienKaiser) av.ok <- Anova(mod.ok, idata=idata, idesign=~phase*hour, type = 3) summary(av.ok, multivariate=FALSE) Now, imagine that the highest order interaction would have been significant (which is not the case) and we would like to explore it further with the following contrasts: Is there a difference between hours 1&2 versus hours 3 (contrast 1) and between hours 1&2 versus hours 4&5 (contrast 2) in the treamtment conditions (A&B together)? In other words, how do I specify these contrasts: 1. ((treatment %in% c("A", "B")) & (hour %in% 1:2)) versus ((treatment %in% c("A", "B")) & (hour %in% 3)) 2. ((treatment %in% c("A", "B")) & (hour %in% 1:2)) versus ((treatment %in% c("A", "B")) & (hour %in% 4:5)) My idea would be to run another ANOVA ommitting the non-needed treatment condition (control). However, I still have no idea how to set up the appropriate within-subject contrast matrix comparing hours 1&2 with 3 and 4&5, respectively. And I am not sure if ommitting the non-needed treatment group is indeed a good idea as it changes the overall errorterm. Before going for Anova() I was also thinking going for lme. However, there are small differences in F and p values between textbook ANOVA and what is returned from anove(lme) (see my question here: http://stats.stackexchange.com/q/14088/442). I also tried using Anova() with lme objects, but Anova() seems to only returns Chi² values for lme objects. So I ended up giving all my hope in John Fox and Anova(). I hope this question on contrsats is okay. I tried to understand Venables & Ripley on model matrices (chapter 6.2, pp. 144, 4th ed.) but this did not help me at all. Thanks in advance, Henrik -- Dipl. Psych. Henrik Singmann PhD Student Institute of Psychology Albert-Ludwigs-Universität Freiburg http://www.psychologie.uni-freiburg.de/Members/singmann [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.