# Can contrasts and interaction contrasts be identical in linear mixed model?

I have a doubt with respect to the estimated marginal means of a linear mixed model. I performed a mixed model like the one in the example below:

library("lme4")
library("emmeans")

model <- lmer(dep_variable ~ covariate * condition + (condition | subject), dataset)
summary(model)
anova(model)


After this, I checked the contrasts:

emmeans(model, pairwise ~ condition)
emmeans(model, pairwise ~ condition | covariate)


I wanted to check which factors (i.e., covariate and condition) affected my dependent variable (i.e., dep_variable). The dependent variable and the covariate were numeric variables, while condition was a factor variable with 3 levels.

After performing the model and checking the estimated marginal means, I realized that the estimated marginal means were the same both when I looked at the main effect condition and when I checked the interaction between covariate and condition.

Moreover, I realized that the contrasts of the interaction were centered at the mean value of the covariate (numeric variable).

I have two questions:

Did I make a mistake? If not, can I change the value of my covariate in order to explore the contrasts by "holding" the covariate to another value (not the mean)?

• By default, only one covariate value is used -- its mean. So the two emmeans calls you show are guaranteed to yield the same results. That is, it doesn't matter whether you explicitly condition on it or not because the same value is used either way. If you use an at specification to specify several covariate values, then you will see an assortment of results in that second call. Jun 16, 2020 at 0:07

When you have interactions, things indeed get more complicated. But what you describe seems valid. That is, you select a specific value for the covariate, and make the pairwise comparisons for the different conditions using this particular value. Also, because you have fitted an interaction model, note that the main effect of condition is interpreted for a specific value of covariate, namely for covariate = 0.
With that in mind, I feel that your question mainly relates to the use of the emmeans package, and therefore, I would suggest having a look at the online documentation. More specifically, in the Interaction Analysis vignette. I would speculate that emmeans(model, pairwise ~ condition) produces results for covariate = mean(covariate) because this is often more relevant than covariate = 0. For example, say that the covariate is age. It makes more sense to produce pairwise comparisons for condition for the average age in your data, than for age = 0 (assuming you have a study on subjects with ages far away from zero).
• It does not use covariate = 0 by default in any situation. i don't know why you say that. Jun 16, 2020 at 0:11
• @RussLenth I think I said that is uses covariate = mean(covariate) because this is more relevant than covariate = 0. Nonetheless, as always, there are exceptions to the rule. In longitudinal data where I work, covariate is time, and there it makes sense to see what happens at baseline, i.e., at time = 0. Jun 16, 2020 at 6:26
• @RussLenth what I mean is that the coefficients for the main effect of condition are interpreted for covariate = 0. That is, in the model $\beta_0 + \beta_1 cond + \beta_2 cov + \beta_3 \{cond \times cov\}$, the coefficient $\beta_1$, what I called the main effect of cond is interpreted for cov = 0. Jun 17, 2020 at 9:43