show_ranef | R Documentation |

`show_ranef()`

allows a user estimating a mixed model to quickly
plot the random intercepts (with conditional variances) of a given random effect
in a mixed model. In cases where there is a random slope over the intercept, the function
plots the random slope as another caterpillar plot (as another facet)

show_ranef(model, group, reorder = TRUE)

`model` |
a fitted mixed model with random intercepts |

`group` |
What random intercept/slopes do you want to see as a caterpillar plot? Declare it as a character |

`reorder` |
optional argument. DEFAULT is TRUE, which “re-orders” the intercepts by the original value in the data. If FALSE, the ensuing caterpillar plot defaults to a default method of ordering the levels of the random effect by their estimated conditional mode. |

This function is a simple wrapper in which `broom.mixed`

and, obviously
`ggplot2`

are doing the heavy lifting.

`show_ranef()`

returns a caterpillar plot of the random intercepts from a given
mixed model. If `broom.mixed::augment()`

can process it, this function should work just fine.

Steven V. Miller

library(lme4) library(stevemisc) data(sleepstudy) M1 <- lmer(Reaction ~ Days + (Days | Subject), data=sleepstudy) show_ranef(M1, "Subject") show_ranef(M1, "Subject", reorder=FALSE)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.