Whereas the direction of main effects can be interpreted from the sign of the estimate, the interpretation of interaction effects often requires plots. This task is facilitated by the R package sjPlot (Lüdecke, 2022). For instance, using the plot_model function, I plotted the interaction between two continuous variables.
``` library(lme4)
library(sjPlot) library(ggplot2)
theme_set(theme_sjplot())
set.seed(101) spin = runif(600, 1, 24) reg = runif(600, 1, 15) ID = rep(c("1","2","3","4","5", "6", "7", "8", "9", "10")) day = rep(1:30, each = 10) testdata <- data.frame(spin, reg, ID, day) testdata$fatigue <- testdata$spin * testdata$reg/10 * rnorm(30, mean=3, sd=2)
fit = lmer(fatigue ~ spin * reg + (1|ID), data = testdata, REML = TRUE)
plot_model(fit, type = 'pred', terms = c('spin', 'reg'))
```
...
Continue reading: How to break up colour variable in sjPlot into equally-sized bins