LGMobject | R Documentation |
Provide flexibility for specifying Mplus LGM objects with various latent class and residual variance structures, and capturing individual differences in growth trajectories.
Support Growth Curve Models (GCM), Growth-Based Trajectory Models (GBTM) and Latent Class Growth Analysis (LCGA).
Once created, the model can be estimated using the runLGM
function.
LGMobject(
data,
outvar,
catvar = FALSE,
idvar,
k,
starting_val,
estimator = c("MLR", "ML", "WLSMV", "WLS"),
transformation = c("LOGIT", "PROBIT"),
lgm_type = c("gcm", "gbtm", "lcga_t", "lcga_c", "lcga_tc"),
polynomial = 1,
timescores,
timescores_indiv = FALSE,
output,
plot,
save
)
data |
A data frame containing all variables for the trajectory analysis. |
outvar |
A character vector specifying the outcome variables at different times. |
catvar |
A logical value indicating whether the outcome variable is categorical. Default is |
idvar |
A character string specifying the ID variable. |
k |
An integer specifying the number of latent classes for the model. |
starting_val |
A numeric value specifying the number of random starting values to generate for the initial optimization stage. Note that the number of final stage optimizations will be set as equal to half of this value. |
estimator |
A character string to specify the estimator to use in the analysis. Default is 'MLR'. |
transformation |
A character string to specify the latent response variable transformation to use when the outcome variable is categorical. Default is |
lgm_type |
A character string specifying the residual variance structure of the growth model. Options include:
|
polynomial |
An integer specifying the order of the polynomial used to model trajectories. Supported values are: 1 (linear), 2 (quadratic), 3 (cubic). Default is 1. |
timescores |
A numeric vector specifying the time scores for the model. If |
timescores_indiv |
A logical value indicating whether to use individually varying times of observation for the outcome variable. Default is |
output |
A character vector specifying the requested Mplus output options for the model. |
plot |
A character string specifying the requested Mplus plot options for the model. |
save |
A character string specifying the type of results to be saved by Mplus. |
The LGMobject
function facilitates and automates the appropriate model specification for conducting latent growth modeling in Mplus.
It creates the relevant sections of an Mplus input file, including: TITLE, VARIABLE, ANALYSIS, MODEL, OUTPUT, PLOT, and SAVEDATA.
This function builds upon the capabilities of the mplusObject
function
from the MplusAutomation package.
A list of class mplusObject
with elements specifying sections of an Mplus input file for conducting latent growth modeling.
mplusObject
for creating an mplusObject.
runLGM
for conducting latent growth modelling with an mplusObject.
# Example usage:
GBTM_object <- LGMobject(
data = symptoms,
outvar = paste("sx", seq(from = 0, to = 24, by = 6), sep = "_"),
idvar = "id",
catvar = FALSE,
k = 3L,
starting_val = 500,
lgm_type = "gbtm",
polynomial = 3,
timescores = seq(from = 0, to = 24, by = 6),
timescores_indiv = FALSE,
output = c("TECH1", "TECH14", "SAMPSTAT", "STANDARDIZED"),
plot = "PLOT3",
save = "FSCORES"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.