getFitFig: Helper Function to Generate Visualization for a Fitted Model

View source: R/FitFig_helper.R

getFitFigR Documentation

Helper Function to Generate Visualization for a Fitted Model

Description

This is an internal function that generates a ggplot object for a fitted model. It is called by the getFigure function.

Usage

getFitFig(
  model,
  nClass,
  cluster_TIC,
  grp_var,
  sub_Model,
  t_var,
  records,
  y_var,
  curveFun,
  y_model,
  xstarts,
  xlab,
  outcome
)

Arguments

model

A fitted mxModel object. This is the output from one of the estimation functions in this package. It takes value passed from getFigure().

nClass

An integer specifying the number of classes for the mixture model or multiple group model. It takes value passed from getFigure().

cluster_TIC

A string or character vector representing the column name(s) for time-invariant covariate(s) indicating cluster formations. It takes value passed from getFigure().

grp_var

A string specifying the column that indicates manifested classes when applicable. It takes the value passed from getFigure().

sub_Model

A string that specifies the sub-model for latent classes. Supported sub-models include "LGCM" (for latent growth curve models), "LCSM" (for latent change score models), "TVC" (for latent growth curve models or latent change score models with a time-varying covariate), "MGM" (for multivariate latent growth curve models or latent change score models), and "MED" (for longitudinal mediation models). It takes value passed from getFigure().

t_var

A string representing the prefix of the column names corresponding to the time variable at each study wave. It takes value passed from getFigure().

records

A numeric vector representing the indices of the study waves. It takes value passed from getFigure().

y_var

A string or character vector representing the prefix of the column names for the outcome variable(s) at each study wave. It takes value passed from getFigure().

curveFun

A string specifying the functional form of the growth curve. Supported options for y_model = "LGCM" include: "linear" (or "LIN"), "quadratic" (or "QUAD"), "negative exponential" (or "EXP"), "Jenss-Bayley" (or "JB"), and "bilinear spline" (or "BLS"). Supported options for y_model = "LCSM" include: "quadratic" (or "QUAD"), "negative exponential" (or "EXP"), "Jenss-Bayley" (or "JB"), and "nonparametric" (or "NonP"). It takes value passed from getFigure().

y_model

A string that specifies how to fit longitudinal outcomes. Supported values are "LGCM" and "LCSM". It takes value passed from getFigure().

xstarts

A numeric value to indicate the starting time of the longitudinal process. It takes value passed from getFigure().

xlab

A string representing the time unit (e.g., "Week", "Month", or "Year") for the x-axis. Default is "Time". It takes value passed from getFigure().

outcome

A string or character vector representing the name(s) of the longitudinal process(es) under examination. It takes value passed from getFigure().

Value

A ggplot object or a list of ggplot objects.


nlpsem documentation built on Sept. 13, 2023, 1:06 a.m.