Learn R Programming

interplot (version 0.1.0.2)

interplot.mlmmi: Plot Conditional Coefficients in Mixed-Effects Models with Imputed Data and Interaction Terms

Description

interplot.mlmmi is a method to calculate conditional coefficient estimates from the results of multilevel (mixed-effects) regression models with interaction terms and multiply imputed data.

Usage

## S3 method for class 'mlmmi':
interplot(m, var1, var2, plot = TRUE, point = FALSE,
  sims = 5000, xmin = NA, xmax = NA)

Arguments

m
A model object including an interaction term, or, alternately, a data frame recording conditional coefficients.
var1
The name (as a string) of the variable of interest in the interaction term; its conditional coefficient estimates will be plotted.
var2
The name (as a string) of the other variable in the interaction term.
plot
A logical value indicating whether the output is a plot or a dataframe including the conditional coefficient estimates of var1, their upper and lower bounds, and the corresponding values of var2.
point
A logical value determining the format of plot. By default, the function produces a line plot when var2 takes on ten or more distinct values and a point (dot-and-whisker) plot otherwise; option TRUE forces a point plot.
sims
Number of independent simulation draws used to calculate upper and lower bounds of coefficient estimates: lower values run faster; higher values produce smoother curves.
xmin
A numerical value indicating the minimum value shown of x shown in the graph. Rarely used.
xmax
A numerical value indicating the maximum value shown of x shown in the graph. Rarely used.

Value

  • The function returns a ggplot object.

Details

interplot.mlmmi is a S3 method from the interplot. It works on lists of mixed-effects objects with class lmerMod and glmerMod generated by mitools and lme4. Because the output function is based on ggplot, any additional arguments and layers supported by ggplot2 can be added with the +.