Fit a Multivariate Latent Growth Curve Model or Multivariate Latent Change Score Model
Fit a Multivariate Latent Growth Curve Model or Multivariate Latent Change Score Model
This function fits a multivariate latent growth curve model or a multivariate latent change score model with the provided data. It manages model setup, optimization, and if requested, outputs parameter estimates and standard errors.
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 multiple longitudinal outcomes.
t_var: A vector of strings, with each element representing the prefix for column names related to the time variable for the corresponding outcome variable at each study wave.
y_var: A vector of strings, with each element representing the prefix for column names corresponding to a particular outcome variable at each study wave.
curveFun: A string specifying the functional forms of the growth curve(s). Supported options for y_model = "LGCM" include: "linear" (or "LIN"), "quadratic" (or "QUAD"), "negative exponential"
intrinsic: A logical flag indicating whether to build an intrinsically nonlinear longitudinal model. Default is TRUE.
records: A list of numeric vectors, with each vector specifying the indices of the observed study waves for the corresponding outcome variable.
y_model: A string specifying how to fit the longitudinal outcome. Supported values are "LGCM" and "LCSM".
starts: A list containing initial values for the parameters. Default is NULL, indicating no user-specified initial values.
res_scale: A numeric vector with each element representing the scaling factor for the initial calculation of the residual variance. These values should be between 0 and 1, exclusive. By default, this is NULL, as it is unnecessary when the user specifies the initial values using the starts argument.
res_cor: A numeric value or vector for user-specified residual correlation between any two longitudinal outcomes to calculate the corresponding initial value. By default, this is NULL, as it is unnecessary when the user specifies the initial values using the starts argument.
tries: An integer specifying the number of additional optimization attempts. Default is NULL.
OKStatus: An integer (vector) specifying acceptable status codes for convergence. Default is 0.
jitterD: A string specifying the distribution for jitter. Supported values are: "runif" (uniform distribution), "rnorm" (normal distribution), and "rcauchy" (Cauchy distribution). Default is "runif".
loc: A numeric value representing the location parameter of the jitter distribution. Default is 1.
scale: A numeric value representing the scale parameter of the jitter distribution. Default is 0.25.
paramOut: A logical flag indicating whether to output the parameter estimates and standard errors. Default is FALSE.
names: A character vector specifying parameter names. Default is NULL.
Returns
An object of class myMxOutput. Depending on the paramOut argument, the object may contain the following slots:
mxOutput: This slot contains the fitted multivariate latent growth curve model or a multivariate latent change score model. A summary of this model can be obtained using the ModelSummary() function.
Estimates (optional): If paramOut = TRUE, a data frame with parameter estimates and standard errors. The content of this slot can be printed using the printTable() method for S4 objects.
Examples
mxOption(model =NULL, key ="Default optimizer","CSOLNP", reset =FALSE)# Load ECLS-K (2011) datadata("RMS_dat")RMS_dat0 <- RMS_dat
# Re-baseline the data so that the estimated initial status is for the starting point of the studybaseT <- RMS_dat0$T1
RMS_dat0$T1 <- RMS_dat0$T1 - baseT
RMS_dat0$T2 <- RMS_dat0$T2 - baseT
RMS_dat0$T3 <- RMS_dat0$T3 - baseT
RMS_dat0$T4 <- RMS_dat0$T4 - baseT
RMS_dat0$T5 <- RMS_dat0$T5 - baseT
RMS_dat0$T6 <- RMS_dat0$T6 - baseT
RMS_dat0$T7 <- RMS_dat0$T7 - baseT
RMS_dat0$T8 <- RMS_dat0$T8 - baseT
RMS_dat0$T9 <- RMS_dat0$T9 - baseT
# Fit linear multivariate latent growth curve modelLIN_PLGCM_f <- getMGM( dat = RMS_dat0, t_var = c("T","T"), y_var = c("R","M"), curveFun ="LIN", intrinsic =FALSE, records = list(1:9,1:9), y_model ="LGCM", res_scale = c(0.1,0.1), res_cor =0.3)# Fit bilinear spline multivariate latent growth curve model (random knots)## Define parameter namesparaBLS_PLGCM.f <- c("Y_mueta0","Y_mueta1","Y_mueta2","Y_knot", paste0("Y_psi", c("00","01","02","0g","11","12","1g","22","2g","gg")),"Y_res","Z_mueta0","Z_mueta1","Z_mueta2","Z_knot", paste0("Z_psi", c("00","01","02","0g","11","12","1g","22","2g","gg")),"Z_res", paste0("YZ_psi", c(c("00","10","20","g0","01","11","21","g1","02","12","22","g2","0g","1g","2g","gg"))),"YZ_res")## Fit modelBLS_PLGCM_f <- getMGM( dat = RMS_dat0, t_var = c("T","T"), y_var = c("R","M"), curveFun ="BLS", intrinsic =TRUE, records = list(1:9,1:9), y_model ="LGCM", res_scale = c(0.1,0.1), res_cor =0.3, paramOut =TRUE, names = paraBLS_PLGCM.f
)printTable(BLS_PLGCM_f)
References
Liu, J., & Perera, R. A. (2021). "Estimating Knots and Their Association in Parallel Bilinear Spline Growth Curve Models in the Framework of Individual Measurement Occasions," Psychological Methods (Advance online publication). tools:::Rd_expr_doi("10.1037/met0000309")
Blozis, S. A. (2004). "Structured Latent Curve Models for the Study of Change in Multivariate Repeated Measures," Psychological Methods, 9(3), 334-353. tools:::Rd_expr_doi("10.1037/1082-989X.9.3.334")