just a quick question regarding main effects and interaction effects:

For example, in a LME model like

lme_model <- lmer(outcome ~ Group*Time + var1 + (1|Sub), data=datatable

In the analysis there would be main effects of group, time (and var1), correct? Group x Time (or Group:Time , does it matter how I write it btw?) would then be called an interaction effect, if I am not mistaken? Someone told me that main effects are without direction. Is that correct? I am pretty sure I am getting I direction shown in the output of summary(lme_model). The interaction effect also has a direction effect, hasn't it?

Maybe the other person used anova(lme_model) to get to that opinion, which instead of summary(lme_model) doesn't produce estimates and a direction for main and interaction effects?

Edit: with direction I meant positive or negative, e.g. there is a negative groupXtime interaction effect

  • 1
    $\begingroup$ I think it really depends on what you mean by direction here. Point estimates from regression coefficients usually give an idea of how a predictor decreases or increases a conditional mean value, which is your outcome variable. Interaction coefficients do the same thing really as far as I know. $\endgroup$ Aug 20, 2022 at 0:32

1 Answer 1


I assume by "direction" you mean "sign" (positive or negative). Then yes, all coefficients — the main effects and the interaction — have a sign.

The sign of the main effect for a variable that interacts with other variables might not be particularly easy to interpret on its own. Same goes for the interaction.

Say the model is $\operatorname{E}\{Y\} = \beta_0 + \beta_1x_1 + \beta_2x_2 + \beta_3x_1x_2$. When $x_2$ changes by one unit, $\operatorname{E}\{Y\}$ changes by $\beta_2 + \beta_3x_1$. The expected change in the response depends on the coefficients $\beta_2$ and $\beta_3$ (and their signs) as well as on the (fixed) value of $x_1$.

There is an easier way to visualize and understand the effects of a predictor that works equally well in models with and without interactions: partial effect plots.

Here is how to create a partial effect plot in R using the ggeffects package.



n <- 100

# Generate data with an interaction between x1 (categorical) and x2 (continuous)
data <-
    x1 = sample(c("A", "B"), n, replace = TRUE),
    x2 = rnorm(n)
data$y <- ifelse(data$x1 == "A", 1 + data$x2, 2 - data$x2 / 3) + rnorm(n)

# Fit the model
model <- lm(y ~ x1 * x2, data = data)

# Make a partial effect plot for the continuous variable, x2,
# at each level of the categorical variable, x1
  ggpredict(model, terms = c("x2", "x1"))
#> Loading required namespace: ggplot2

Created on 2022-08-20 with reprex v2.0.2

  • $\begingroup$ Thank for the answer; also ggpredict looks very neat! $\endgroup$
    – Zucchini
    Aug 20, 2022 at 20:50

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.