Learn R Programming

mlmtools (version 1.0.2)

caterpillarPlot: Caterpillar Plot

Description

Plots empirical Bayes both point prediction and prediction intervals for each random effect parameter across all groups.

Usage

caterpillarPlot(
  model,
  grouping,
  title = print(grouping),
  tall = TRUE,
  grey = FALSE
)

Value

Produces a caterpillar plot.

Arguments

model

A given lmer model.

grouping

The name of the grouping variable of interest, as a character string.

title

The title of the plot.

tall

Logical argument specifying whether the plot should be plotted vertically or horizontally.

grey

Logical argument specifying whether the intervals should be plotted in color or greyscale.

References

Rabe-Hesketh S, Skrondal A (2012). Multilevel and Longitudinal Modeling Using Stata, Volumes I and II, Third Edition. 3 edition edition. Stata Press. ISBN 978-1-59718-108-2.

Examples

Run this code
# Read in data
data(instruction)
# Create model
mod <- lme4::lmer(mathgain ~ (1 | classid), data = instruction)
# Produce caterpillar plot
caterpillarPlot(mod, title = "title", grouping = "classid", grey = TRUE)

Run the code above in your browser using DataLab