depictr.random_effects_plot#

depictr.random_effects_plot(model, title=None)#

Caterpillar plot of the predicted random effects (BLUPs).

Each point is one group level’s predicted random effect, the deviation of that group from the population fit. Levels are sorted by their effect, so the plot reads as a tilted ladder from the most negative to the most positive group, against a zero reference line. A group whose interval clears zero stands apart from the average; one straddling zero does not.

The points come straight from model.random_effects. When the fit exposes the conditional covariance of each group’s effects (model.random_effects_cov), the diagonal gives a conditional standard error and the plot adds a 95% interval (the point estimate plus or minus 1.96 standard errors); without it the points are drawn on their own. If the model has more than one random-effect term per group (a random intercept and one or more random slopes), the terms are shown in separate panels.

Parameters:
  • model (statsmodels MixedLMResults) – A fitted MixedLM result, as returned by MixedLM(...).fit() or smf.mixedlm(...).fit().

  • title (str, optional) – Plot title.

Return type:

plotnine.ggplot

Notes

The interval is the conditional one around each predicted effect, not a confidence interval for a fixed parameter. It reflects how precisely that group’s effect is pinned down given the fitted variance components.