Post hoc tukey test for two-way mixed ANOVA model

I and some of my students have been looking for a solution to this in many places with no luck and literally for several months. I keep referring to the lme command which I DO NOT want to use. The output shown is not the one that my colleagues or I have been using for over 15 years. Moreover, given that I use R as a teaching tool, it does not flow also after t-tests, but a one-way anovas for student intro statistics. I'm doing a two-way RM ANOVA with one factor repetition. I managed to get R to reproduce what Sigmaplot gives for basic effects. However, the post-hoc analysis provided by R differs significantly from the same post-hoc analysis in Sigmaplot. Here is the code I used - with notes (since I use this for teaching students too).

#IV between: IVB1 - Independent variable - between subject factor
#IV within: IVW1  - Independent variable - within subject factor
#DV: DV           - Dependent variable.

aov1= aov(DV ~ IVB1*IVW1 + Error(Subject/IVW1)+(IVB1), data=objectL)

# post hoc analysis
ph1=TukeyHSD(aov(DV ~ IVB1*IVW1, data=objectL))


I hope someone can help. Thank!


source to share

1 answer

I also had this problem and found a convenient alternative to the aov_ez () function from the afex package instead of aov (), and then did a post hoc analysis using lsmeans () instead of TukeyHSD ():

model <- aov_ez(data,                           
            within=c("IVW1", "IVW2"), 
            between = "IVB1")

# Post hoc
comp = lsmeans(model,specs = ~ IVB1: IVW1: IVW2, adjust = "tukey")


You will find a detailed tutorial below:



All Articles