3
votes

I am doing a repeated measures anova with a mixed model. I would like to run a post hoc test to see the p-values of the interaction TREAT*TIME, but I only managed to use the following ghlt Tukey test which do not give me the interaction I am looking for.

library(multcomp)
library(nlme)
oi<-lme(total ~ TREAT * TIME, data=TURN, random = ~1|NO_UNIT)
anova(oi)
summary(glht(oi, linfct=mcp(TIME="Tukey", TREAT="Tukey")))

what I would be looking for is something like:

summary(glht(oi, linfct=mcp(TIME="Tukey",TREAT="Tukey",TREAT*TIME="Tukey")))
3

3 Answers

2
votes

Use snk.test(model, term="TREAT*TIME", among="TREAT", within="TIME") from the package GAD if you have a balanced model and summary( lsmeans( oi, pairwise ~ TIME*TREAT), infer=TRUE) from lsmeans if your model is unbalanced

0
votes

I have also had this problem. It appears that a straight-forward post hoc test for two way ANOVAs does not exist. However, you may like to try bootstrapping, which is a form of robust estimation for a two-way ANOVA. I found the following link very helpful.

http://rcompanion.org/rcompanion/d_08a.html

It contains a step-by-step tutorial using the rcompanion,WRS2, psych, and multcompView packages to perform your bootstrapped ANOVA and follow up with a post hoc. Good luck.

0
votes

For a mixed model you can find an alternative with the aov_ez() function from the afex package instead of lme(), and then performe post hoc analysis using lsmeans().

You will find a detailed tutorial here:

https://www.psychologie.uni-heidelberg.de/ae/meth/team/mertens/blog/anova_in_r_made_easy.nb.html