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
Value
Returns one or several ggplots. In case one plot is returned it can be appended with `theme`, `geom_`, etc.
Examples
if (FALSE) { # \dontrun{
random_plot(lmr,
optional.names=c(`(Intercepts)`="Intercepts",
gndr ="Female", s.Age = "Effects of age"),
facets=TRUE)
} # }
