简体   繁体   中英

R - Mixed Design ANOVA post hoc test

I have the following data structure (with example values):

id     var1     var2   value
1      true     tr     1.34
2      true     ct     4.89
3      false    mm     2.38
4      true     tr     1.28

The data is saved in 'longData'. So 'var1' is between subject variable that can be true or false, 'var2' is a within subject factor with 3 levels (tr, ct, mm) and 'value' is a numeric value.

I've made a mixed design ANOVA like this:

anovaResult = ezANOVA(data=longData, 
                                dv=.("value"), 
                                wid=.("id"),
                                within=.("var2"),
                                between=.("var1"),
                                type=3)

The result showed signifikant interaction between var1 and var2. Now I would like to examine this interaction further, but I don't know how. I've heard about the emmeans package (estimated marginal means seems to be the statistic of choice here, since I am new to statistics, feel free to advise me otherwise) but could not get the command to work. This is probably because I am new to R and do not understand the syntax fully.

Can anyone provide me with a working example of how to test the interaction between the two factors? I would not say no to an explanation of how to interpret the results as well.

I know this is much I am asking for, but I cannot figure it out for myself and have to present results soon without much time to learn statistics and R. Thank you.

It would help to provide an example dataset.

However, you can run a Tukey test:

mod1<-aov(value~Factor1*Factor2, df)
TukeyHSD(mod1)

Or to run emmeans on an Anova with an interaction:

mod1<-aov(value~Factor1*Factor2, df)
library(emmeans)
emmeans(mod1, pairwise~Treatment*Time)

Or to do a mixed model, which is what you seem to be doing:

mod1<-lmer(value~Factor1*Factor2+(1|subject), df)
Anova(mod1)
summary(mod1)
emmeans(mod1, pairwise~Factor1*Factor2)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM