getsub.MED_m: Define Longitudinal Mediation Models as Class-specific Models...

View source: R/MGroup.SUBMODEL.MED_helper.R

getsub.MED_mR Documentation

Define Longitudinal Mediation Models as Class-specific Models (Submodels) for a Longitudinal Multiple Group Model

Description

This function defines longitudinal mediation models as class-specific models (submodels) for a longitudinal multiple group model.

Usage

getsub.MED_m(
  dat,
  nClass,
  grp_var,
  t_var,
  y_var,
  curveFun,
  records,
  m_var,
  x_var,
  x_type,
  starts,
  res_cor
)

Arguments

dat

A wide-format data frame, with each row corresponding to a unique ID. It contains the observed variables with repeated measurements and occasions for each longitudinal process, and time-invariant covariates (TICs) if any. It takes the value passed from getMGroup().

nClass

An integer specifying the number of manifested classes for the multiple group model. It takes the value passed from getMGroup().

grp_var

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

t_var

A vector of strings, with each element representing the prefix for column names related to the time variable for the corresponding longitudinal variable at each study wave. It takes the value passed from getMGroup().

y_var

A string specifying the prefix of the column names corresponding to the outcome variable at each study wave. It takes the value passed from getMGroup().

curveFun

A string specifying the functional form of the growth curve. Supported options include: "linear" (or "LIN"), and "bilinear spline" (or "BLS"). It takes the value passed from getMGroup().

records

A list of numeric vectors, with each vector specifying the indices of the observed study waves for the corresponding longitudinal variable. It takes the value passed from getMGroup().

m_var

A string specifying the prefix of the column names corresponding to the mediator variable at each study wave. It takes the value passed from getMGroup().

x_var

A string specifying the baseline predictor if x_type = "baseline", or the prefix of the column names corresponding to the predictor variable at each study wave if x_type = "longitudinal". It takes the value passed from getMGroup().

x_type

A string indicating the type of predictor variable used in the model. Supported values are "baseline" and "longitudinal". It takes the value passed from getMGroup().

starts

A list of initial values for the parameters, either takes the value passed from getMGroup() or derived by the helper function getMGroup.initial().

res_cor

A numeric value or vector for user-specified residual correlation between any two longitudinal processes to calculate the corresponding initial value. It takes the value passed from getMGroup().

Value

A list of manifest and latent variables and paths for an mxModel object.


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