3

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")))
kumbu
  • 145
  • 2
  • 16

3 Answers3

2

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

kumbu
  • 145
  • 2
  • 16
0

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.

J.Con
  • 4,101
  • 4
  • 36
  • 64
  • 1
    Hi! thanks for your answer. However i looked a bit deeper into that and asked some people and actually those functions exist. 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. Enjoy! – kumbu Nov 30 '16 at 10:19
  • @kumbu, this is great! I didn't ask this question but now I have an answer. :) – J.Con Nov 30 '16 at 21:10
0

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