I have problems finding a solution regarding how to run a post-hoc test (Tukey HSD) after a 2-factor (both within-subjects) repeated-measures ANOVA in R. For the ANOVA, I've used the aov -function:
summary(aov(dv ~ x1 * x2 + Error(subject/(x1*x2)), data=df1))
After reading answers to other questions, I gathered that I would first have to re-run the ANOVA using some other fuction (e.g., lme). This is what I came up with.
Lme.mod <- lme(dv ~ x1*x2, random=list(subject=pdBlocked(list(~1, pdIdent(~x1-1), pdIdent(~x2-1)))), data=df1)
anova(Lme.mod)
Both main effects were significant, but there were no interaction effects. Then, I used these functions for the post-hoc comparisons:
summary(glht(Lme.mod, linfct=mcp(x1="Tukey")))
summary(glht(Lme.mod, linfct=mcp(x2="Tukey")))
However, there were some problems:
First of all, the R Help file says that "The mcp function must be used with care when defining parameters of interest in two-way ANOVA or ANCOVA models (...) multcomp version 1.0-0 and higher generates comparisons for the main effects only, ignoring covariates and interactions (older versions automatically averaged over interaction terms). A warning is given." And sure enough, I received the following warning message:
Warning message:
In mcp2matrix(model, linfct = linfct) :
covariate interactions found -- default contrast might be inappropriate
Another puzzling thing was that although both main effects were significant, there were no significant differences in the post-hoc comparisons for one of the factors (x1). I've never encountered this before. Are the scripts/analyses correct/appropriate, or is there something that I'm missing? Any help would be most appreciated!