The saved examples below were generated with nlpsem 1.0.0.9006;
extdata/REGENERATED.txt records the versions and how the
fits compare with the previous ones. Rendering this guide does not refit
its disabled model-fitting chunks. Refit with the current version for a
new analysis, use getDiagnostics() to check admissibility
and uncertainty, and compare multiple starts for difficult nonlinear or
mixture models. These examples are not evidence of numerical
qualification.
# Load ECLS-K (2011) data
data("RMS_dat")
RMS_dat0 <- RMS_dat
# Re-baseline the data so that the estimated initial status is for the
# starting point of the study
baseT <- 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
# Standardize time-invariant covariates (TICs)
## ex1 and ex2 are standardized growth TICs in models
RMS_dat0$ex1 <- scale(RMS_dat0$Approach_to_Learning)
RMS_dat0$ex2 <- scale(RMS_dat0$Attention_focus)
xstarts <- mean(baseT)Math_LGCM_BLS_f <- getLGCM(
dat = RMS_dat0, t_var = "T", y_var = "M", curveFun = "bilinear spline",
intrinsic = TRUE, records = 1:9, growth_TIC = NULL, tries = 10
)
Math_LGCM_BLS_r <- getLGCM(
dat = RMS_dat0, t_var = "T", y_var = "M", curveFun = "bilinear spline",
intrinsic = FALSE, records = 1:9, growth_TIC = NULL, tries = 10
)getLRT(
full = Math_LGCM_BLS_f@mxOutput, reduced = Math_LGCM_BLS_r@mxOutput, boot = FALSE, rep = NA
)
#> # of Free Param -2loglik Degree of Freedom Diff in loglik
#> Full Model 15 31261.60 4485 NA
#> Reduced Model 11 31347.39 4489 85.78892
#> Diff in DoF p.values AIC BIC
#> Full Model NA NA 31291.60 31354.82
#> Reduced Model 4 1.03177e-17 31369.39 31415.75The stored comparison has four additional parameters for the
random-knot model. Its likelihood and AIC/BIC summarize these particular
fitted solutions. The ordinary chi-square p-value is not a validated
significance test for the random-knot effect: the loading formulas use
different smoothing, latent covariance admissibility must be checked,
and the null model’s regularity conditions require justification. See
?getLRT for nesting, same-data and bootstrap requirements.
Bootstrapping does not automatically correct non-nesting or an
inadmissible fitted model. Use getDiagnostics() and
repeated starts before interpreting either solution.
Math_LGCM_TIC_BLS_f <- getLGCM(
dat = RMS_dat0, t_var = "T", y_var = "M", curveFun = "bilinear spline",
intrinsic = TRUE, records = 1:9, growth_TIC = c("ex1", "ex2"),
tries = 10, paramOut = TRUE
)Math_LGCM_TIC_BLS_f@Estimates
#> Name Estimate SE
#> 1 alpha0 3.946156e+01 0.485884890
#> 2 alpha1 1.761586e+00 0.016585418
#> 3 alpha2 6.786552e-01 0.015648003
#> 4 alphag 3.516124e+01 0.428935881
#> 5 psi00 1.017760e+02 7.479973627
#> 6 psi01 5.426046e-01 0.181099738
#> 7 psi02 -4.301106e-01 0.170415680
#> 8 psi0g -1.654138e+01 4.661110632
#> 9 psi11 8.735413e-02 0.008786026
#> 10 psi12 -4.589649e-03 0.005797510
#> 11 psi1g -5.309019e-01 0.177277756
#> 12 psi22 1.384221e-02 0.008202612
#> 13 psi2g -1.141548e-01 0.176318438
#> 14 psigg 2.954858e+01 6.074984601
#> 15 residuals 3.149364e+01 0.888291839
#> 16 beta10 2.311643e+00 0.752625285
#> 17 beta11 -4.392197e-02 0.026052725
#> 18 beta12 -1.901185e-02 0.023778156
#> 19 beta1g 2.186632e-01 0.645450511
#> 20 beta20 2.091795e+00 0.758076722
#> 21 beta21 1.149117e-01 0.026150147
#> 22 beta22 -1.487944e-02 0.023844276
#> 23 beta2g -9.864440e-01 0.642813795
#> 24 mux1 -3.662941e-07 0.044678221
#> 25 mux2 -3.481922e-07 0.044678045
#> 26 phi11 9.979989e-01 0.063082846
#> 27 phi12 7.759370e-01 0.056492149
#> 28 phi22 9.979986e-01 0.063082848
#> 29 mueta0 3.946155e+01 0.520103625
#> 30 mueta1 1.761586e+00 0.017017993
#> 31 mueta2 6.786552e-01 0.015711189
#> 32 mu_knot 3.516124e+01 0.430559175
Figure1 <- getFigure(
model = Math_LGCM_TIC_BLS_f@mxOutput, nClass = NULL, cluster_TIC = NULL, sub_Model = "LGCM",
y_var = "M", curveFun = "BLS", y_model = "LGCM", t_var = "T", records = 1:9,
m_var = NULL, x_var = NULL, x_type = NULL, xstarts = xstarts, xlab = "Month",
outcome = "Mathematics"
)
show(Figure1)
#> figOutput Object
#> --------------------
#> Trajectories: 1
#> Figure 1:
#> `geom_smooth()` using method = 'gam' and formula = 'y ~ s(x, bs = "cs")'In the provided output, the terms alpha0, alpha1, alpha2, and alphag denote the conditional mean values of the intercept, first slope, second slope, and knot on growth TICs. The terms mueta0, mueta1, mueta2, and mu_knot represent the mean values of the intercept, first slope, second slope, and knot. These corresponding values match as we’ve centered the growth TICs.
The mean values of growth factors suggest that the rate of progress in mathematical ability slowed down after approximately 35.16 months since the beginning of the study. Moreover, the psi terms indicate the unexplained variance or covariance of the growth factors, while residuals corresponds to residual variance.
Moreover, beta10, beta11, beta12, and beta1g are path coefficients from the first growth TIC (i.e., baseline teacher-reported approach to learning) to the intercept, first slope, second slope, and knot, respectively. Similarly, beta2’s correspond to the path coefficients of the baseline teacher-reported attentional focus.
The interpretations of these coefficients are rather intuitive. For instance, a beta1g value of \(0.2187\) implies that a one standardized unit increase in baseline teacher-reported approach to learning delays the transition time to slower development by \(0.2187\) months. Similarly, a beta2g value of \(-0.9865\) indicates that a one standardized unit increase in baseline teacher-reported attentional focus advances the transition time to slower development by \(0.9865\) months.
However, caution is required when considering potential colinearity between growth TICs. The graphic representation of mathematical development also supports the observation that developmental pace slows down in later stages.