I'm using a linear mixed effects model to analyze the reaction time of learners of English as a Second Language (ESL). I have two factor variables: grammaticality (grammatical v.s. ungrammatical) and finiteness (finite v.s. nonfinite), as well as one numeric variable: proficiency.

I'd like to analyze how their proficiency may affect their sensitivity to grammaticality and finiteness, so I built the model like this:

fitnonnative7 <- lmer(data = nonnative, 
                      formula = RT ~ Grammaticality * Finiteness * Proficiency + (Grammaticality|subject) + (Grammaticality|item))

I got a marginal interaction between grammaticality and finiteness as well as a a marginal interaction between grammaticality, finiteness, and proficiency. How am I supposed to do the post-hoc analysis?

The result of the linear mixed effect model can be found here. I also tried the marginaleffects package to estimate the three-way interaction. Details of this package can be found here. This is what I have have so far:

I might have done something wrong, as the result doesn't tell me the interaction between grammaticality and finiteness. How do I analyze the two-way and three-way interactions properly?


1 Answer 1


Typically, you shouldn't look at the 2-way interactions if you have included a 3-way interaction into the model. I find the emmeans package function emtrends easy to use when unpacking interactions involving categorical and continuous predictors. Try

emt<-emtrends(fitnonnative7, ~"Grammaticality*Finiteness", var="Proficiency")

for the 3-way interaction. This gives you the slope coefficients of "Proficiency" for different levels of Grammaticality*Finiteness. You can test differences between slopes at different levels of the interaction by

pairs(emt)   #use this instead of the contrast(emt)

If you want to look at the 2-way interaction and think it'll be fine even with the 3-way interaction included, you can use

em<-emmeans(fitnonnative7, pairwise~Grammaticality|Finiteness)
em$emmeans       #estimated marginal means for the 2-way interaction
em$contrasts     #contrasts between the above emm's
  • $\begingroup$ Thank you so much, Sointu! That helped a lot! But still some little questions. 1) I tried the emtrends function and for the four conditions, the slope coeffecient was: -0.289, -1.778, -3.515, -1.448 (can we interpret the trend as small or big?) 2) The contrast function did not find significant difference between the slopes in the four conditions. I'm not so sure how did the function compare the slopes. I mean if it compares every two slopes, we should get 6 pairs. But the result shows "grammatical finite effect", "grammatical nonfinite effect". $\endgroup$
    – Yang Cao
    Jun 6 at 11:36
  • $\begingroup$ Whether the trends are small or big depends on the scales of your variables and the subject matter, it's impossible to say based on numbers alone (especially as I assume these are unstandardized regression coefficients). Sorry about the comparisons - try pairs(emt) instead of the contrast command, you should get the 6 comparisons then. I'll edit this into my reply. $\endgroup$
    – Sointu
    Jun 6 at 16:20
  • $\begingroup$ Huge thanks! Just tried the pairs(emt), didn't get anything significant.=)) That's an interesting result! May I confirm another thing: is it proper to produce plots to present the connection between each of the four levels and Proficiency, with the slope that we have got. And even though we couldn't tell the slope is big nor small directly, the lack of the interaction between Finiteness and Proficiency and between Grammaticality and Proficiency (the result of the linear mixed effects model) might have told that it's not big/significant? Sorry for so many confusions. $\endgroup$
    – Yang Cao
    Jun 8 at 11:56
  • $\begingroup$ I think it's always a good idea to present the data visually. Based on how you describe your results it seems that the relationship between proficiency and RT does not differ between the Finiteness*Grammatically combinations. Proficiency could still have a strong main effect or possibly a 2-way interaction between either Finiteness or Grammaticality on RT. So you might want to check those. However I think to get better advise, it would be good to post your output and the plots :) $\endgroup$
    – Sointu
    Jun 8 at 12:28
  • $\begingroup$ Thank you so much for the ideas and support!!=))) $\endgroup$
    – Yang Cao
    Jun 8 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.