Takes object produced by lme4::lmer() function, extracts random effects and interactions, and returns ggplot2-based plots to examine.
Arguments
- lmer.fit
A mer object
- optional.names
A named vector of random effects, where names indicate terms and values are used as axis x labels in correspomding plot. The length should be equal to a number of random effects. Usually it includes "(Intercepts)" and names of variables whose effects are made random.
- facets
Logical. Should the random effects be plotted in facets or as a series of single plots?
If the plots should be actually printed, valid only if facets = F
- scatter
Logical. Should the scatterplots of the cross-level interactions be plotted? If TRUE, `facets` argument corresponds to scatterplots. This option is under development...
Value
Returns one or several ggplots. In case one plot is returned it can be appended with `theme`, `geom_`, etc.
Examples
random_plot(lmr, optional.names=c(`(Intercepts)`="Intercepts", gndr="Female", s.Age = "Effects of age"), facets=TRUE)
#> Error: object 'lmr' not found