random_plot: Plot random effects and interactions for lmer objects

random_plotR Documentation

Plot random effects and interactions for lmer objects

Description

Takes object produced by lme4::lmer() function, extracts random effects and interactions, and returns ggplot2-based plots to examine.

Usage

random_plot(lmer.fit, optional.names = NA, facets = FALSE, print = T)

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?

print

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)

MaksimRudnev/LittleHelpers documentation built on Nov. 5, 2024, 10:16 p.m.