I have a problem 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 + (1 + 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).
My questions would be two:
- Did I make a mistake?
- If not, can I "move" the value of my covariate in order to check the contrasts by holding the covariate to another value (not the mean)?
Any help would be greatly appreciated.
Thanks in advance.