Learn R Programming

mlmtools (version 1.0.2)

betweenPlot: Plots Between Group Associations

Description

Plots the between-group associations between an outcome and predictor variable.

Usage

betweenPlot(
  x,
  y,
  grouping,
  dataset,
  xlab = x,
  ylab = y,
  between_title = "Between-Group Association Plot",
  point_color = "gray40",
  line_color = "black",
  se = FALSE,
  full_range = FALSE,
  lty = 1,
  size = 2
)

Value

Produces a plot of the between-group associations between an outcome and predictor variable.

Arguments

x

Predictor variable.

y

Outcome variable.

grouping

Grouping variable.

dataset

A dataset containing the predictor, outcome, and grouping variables.

xlab

Character vector specifying the horizontal axis label.

ylab

Character vector specifying the vertical axis label.

between_title

Character vector specifying the title for the between group plot.

point_color

Color for points.

line_color

Color for lines.

se

A logical value indicating whether confidence intervals should be displayed.

full_range

A logical value indicating whether the fit line should span the full range of the plot or just the data.

lty

Line type.

size

Width of fit line.

References

Chow, S., Gilmore, R. O., Hallquist, M., Ram, N., & Brinberg, M. (2019). Introduction to multilevel model and interactions. GitHub. https://github.com/psu-psychology/r-bootcamp-2019/blob/master/talks/RBootcamp_MLMInteractions_2019_0820_Final2.Rmd

Examples

Run this code
# Read in data
data(instruction)
# Produce between plot
betweenPlot(x = "mathkind", y = "mathgain", grouping = "classid",
dataset = instruction, xlab = "Kindergarten Math Score",
ylab = "Gain in Math Score")

Run the code above in your browser using DataLab