Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plotMixtures

Create latent profile plots


Description

Creates a profile plot for a single object of class 'mplus.model', or a faceted plot of profile plots for an object of class 'mplus.model.list'.

Usage

plotMixtures(
  modelList,
  variables = NULL,
  coefficients = c("unstandardized", "stdyx.standardized", "stdy.standardized",
    "stdy.standardized"),
  parameter = c("Means", "Intercepts"),
  ci = 0.95,
  bw = FALSE,
  rawdata = FALSE,
  alpha_range = c(0, 0.1)
)

Arguments

modelList

A list of Mplus mixture models, or a single mixture model

variables

A character vectors with the names of the variables (included in the Mplus output) to be plotted.

coefficients

Which type of coefficients to plot on the y-axis; default is 'unstandardized'. Options include: c('stdyx.standardized', 'stdy.standardized', 'std.standardized')

parameter

Which parameter to plot (from Mplus parameter estimate headings included in the output). Defaults to c('Means', 'Intercepts').

ci

What confidence interval should the errorbars span? Defaults to a 95% confidence interval. Set to NULL to remove errorbars.

bw

Logical. Should the plot be black and white (for print), or color?

rawdata

Should raw data be plotted in the background? Setting this to TRUE might result in long plotting times. Requires including the Mplus syntax 'SAVEDATA: FILE IS "filename"; SAVE = cprobabilities' in the Mplus input.

alpha_range

The minimum and maximum values of alpha (transparancy) for the raw data. Minimum should be 0; lower maximum values of alpha can help reduce overplotting.

Value

An object of class 'ggplot'.

Author(s)

Caspar J. van Lissa

Examples

## Not run: 
createMixtures(classes = 1:4, filename_stem = "cars",
               model_overall = "wt ON drat;",
               model_class_specific = "wt;  qsec;",
               rdata = mtcars,
               usevariables = c("wt", "qsec", "drat"),
               OUTPUT = "standardized")
runModels(replaceOutfile = "modifiedDate")
cars_results <- readModels(filefilter = "cars")
plotMixtures(cars_results, rawdata = TRUE)

## End(Not run)
## Not run: 
plotMixtures(cars_results, variables = "wt")

## End(Not run)
## Not run: 
plotMixtures(cars_results, coefficients = "stdyx.standardized")

## End(Not run)

MplusAutomation

An R Package for Facilitating Large-Scale Latent Variable Analyses in Mplus

v0.8
LGPL-3
Authors
Michael Hallquist [aut, cre], Joshua Wiley [aut], Caspar van Lissa [ctb], Daniel Morillo [ctb]
Initial release
2020-09-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.