# Plotting random effects in mixed-effects model

I have tried reading the documentation in sjPlot but couldn't figure it out. In a multilevel / hierarchical / mixed-effect model, ran with lme4 in R, the summary() output give an estimated variance and standard deviation for each random effect. I wanted to plot this variance by level of one of my random intercepts (stimuli), to see differences across stimuli: for the model:

m.EDA = lmer(EDA_cs ~ Cond * Time_sd + (1|Participant) + (1|Stim),
data= phys)


I used the following code from sjPlot to visualize the variance of each level of my random intercept Stim:

plot_model(m.EDA, type = "re")


The question... how come the x-axis (which I thought represents the variance) has negative values?

Variance can't be negative, which makes me think that the x-axis in this plot is plotting something else other than the random effects (which is what the documentation suggests: https://strengejacke.github.io/sjPlot/reference/plot_model.html)

It is plotting the random effects, not the variances of anything. This is what the manual says:

plot_model() creates plots from regression models, either estimates (as so-called forest or dot whisker plots) or marginal effects.

and

type = "re"

For mixed effects models, plots the random effects.


also, you write:

summary() output give an estimated variance and standard deviation for each random effect.

which is correct. If you want to plot those variances against something else, you will have to capture them. You can, I believe, find the right term from using str() with the name of your model in the parens, and then use that to create a plot.

• Thanks for the response. What does random effect mean here? the equivalent to the beta coefficient in a fixed effect? Commented Sep 28, 2023 at 8:09
• Pretty much, yes. But you often aren't interested in it. The random effect is often the variable that accounts for the clustering. Commented Sep 28, 2023 at 9:54
• In this case I am interested because one of my Stim (Artik) showed the opposite effect than the predicted (while all the other Stims followed the hypothesis), so I was wondering if the random effect could tell me something about it, and as you can see in the graph, it is the one with the most negative random effect... but not sure how to interpret it, so I might just leave the discussion on random effects out of the paper. Commented Sep 28, 2023 at 10:05