I am using lmer() to run an analysis with one categorical variable with 2 levels (task) and one continuous variable (farFC). Below is the model:

model <- lmer(respTime ~ task*farFC+ (1 | Subject),dt,control=lmerControl(optimizer = "bobyqa"))

Here is the output:

enter image description here

How do I run contrasts for the interaction term? When I use the code below I only get the task comparison at one specific value of farFC = 4.42 which I am assuming is the midpoint. But, how do I get the value at different values of farFC? Is there a way to change the default midpoint?

emm3 = emmeans(p3, specs = pairwise ~ task|farFC)

enter image description here


1 Answer 1


For an interaction between a factor and a covariate, what we have is different linear trends for each factor level, and accordingly I suggest you consider looking at emtrends(), which estimates the different slopes and allows you to compare them.

Otherwise, you can specify different values to use by adding an at argument, e.g., at = list(farFC = c(2,4,6)).

I also suggest taking a look at the vignettes that come with the package. There are several, with numerous examples. The Basics vignette describes what the default value is for a covariate (it is not the midpoint) and the use of at. The Interactions vignette has discussions and examples of several approaches with interactions. There is even an index of vignette topics.


Your Answer

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

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