descriptives(mydata1, vars = vars(StandardScoreMathConceptsApplicationsTime1, StandardScoreLetterWordRecognitionTime1, CADHDCOMF19), missing = TRUE)
##
## DESCRIPTIVES
##
## Descriptives
## ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## StandardScoreMathConceptsApplicationsTime1 StandardScoreLetterWordRecognitionTime1 CADHDCOMF19
## ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## N 226 224 141
## Missing 12 14 97
## Mean 103.1062 100.0223 1.599749
## Median 103.0000 100.0000 1.461538
## Standard deviation 15.47032 14.67509 0.5034354
## Minimum 55 47 1.000000
## Maximum 145 142 3.833333
## ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
descriptives(mydata1, vars = vars(CASIDEPF19, CASIDEPS20, CASI_MDE_F20, CASI_MDE_S21), missing = TRUE)
##
## DESCRIPTIVES
##
## Descriptives
## ──────────────────────────────────────────────────────────────────────────────────
## CASIDEPF19 CASIDEPS20 CASI_MDE_F20 CASI_MDE_S21
## ──────────────────────────────────────────────────────────────────────────────────
## N 145 153 133 151
## Missing 93 85 105 87
## Mean 1.137931 1.134532 1.131579 1.170530
## Median 1.000000 1.000000 1.000000 1.000000
## Standard deviation 0.3032392 0.2520247 0.2621642 0.3100684
## Minimum 1.000000 1.000000 1.000000 1.000000
## Maximum 2.750000 2.250000 2.750000 2.750000
## ──────────────────────────────────────────────────────────────────────────────────
descriptives(mydata1, vars = vars(CASIANXF19, CASIANXS20, CASI_ANX_F20, CASI_ANX_S21), missing = TRUE)
##
## DESCRIPTIVES
##
## Descriptives
## ──────────────────────────────────────────────────────────────────────────────────
## CASIANXF19 CASIANXS20 CASI_ANX_F20 CASI_ANX_S21
## ──────────────────────────────────────────────────────────────────────────────────
## N 145 153 133 151
## Missing 93 85 105 87
## Mean 1.382184 1.374481 1.372359 1.374961
## Median 1.000000 1.285714 1.285714 1.333333
## Standard deviation 0.4744216 0.3460275 0.3309571 0.3665521
## Minimum 1.000000 1.000000 1.000000 1.000000
## Maximum 3.000000 3.111111 2.444444 2.888889
## ──────────────────────────────────────────────────────────────────────────────────
tabyl(mydata1$SchoolCode2)
## mydata1$SchoolCode2 n percent
## 1 15 0.06302521
## 2 63 0.26470588
## 3 51 0.21428571
## 4 73 0.30672269
## 5 16 0.06722689
## 6 20 0.08403361
#Average literacy score is slightly lower than math scores
#Attention symptoms are, on average, slightly lower than the mid-point of the scale
#Depression scores appear to be similar from F19 to S21, although the maximum score was a little lower in S20
#Median anxiety score increases over time (F19 to S21), although the maximum score decreased in general over time
#correlation Matrix
corrplot(cor1b, method = "color",type = "upper",
p.mat = cor1$p, addCoef.col = 'black', sig.level = 0.05,
insig = "label_sig", number.cex=0.8, tl.col="black",
col=colorRampPalette(c("#94AEBC", "white", "thistle"))(50))

#Anxiety at T1 are strongly positively correlated with depression at T1, and moderately positively correlated with attention symptoms at T1, depression at T4, and anxiety at T4
#Depression at T1 is moderately positively correlated with attention symptoms at T1, depression at T4, and anxiety at T4
#Math and literacy scores are strongly positive correlated
#Literacy scores is weakly negatively correlated with depression at T1 but no other variables
#depression
model1 <- lm(data = mydata1, CASI_MDE_S21 ~ SchoolCode2 + CASIDEPF19 + CADHDCOMF19 + StandardScoreMathConceptsApplicationsTime1 + StandardScoreLetterWordRecognitionTime1)
summary(model1)
##
## Call:
## lm(formula = CASI_MDE_S21 ~ SchoolCode2 + CASIDEPF19 + CADHDCOMF19 +
## StandardScoreMathConceptsApplicationsTime1 + StandardScoreLetterWordRecognitionTime1,
## data = mydata1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.38970 -0.12828 -0.05951 0.10775 0.94102
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 3.865e-01 2.970e-01 1.301
## SchoolCode2 2.780e-02 1.830e-02 1.519
## CASIDEPF19 4.205e-01 1.484e-01 2.834
## CADHDCOMF19 8.356e-02 5.467e-02 1.529
## StandardScoreMathConceptsApplicationsTime1 -2.545e-05 2.306e-03 -0.011
## StandardScoreLetterWordRecognitionTime1 8.162e-04 2.562e-03 0.319
## Pr(>|t|)
## (Intercept) 0.19655
## SchoolCode2 0.13222
## CASIDEPF19 0.00571 **
## CADHDCOMF19 0.12996
## StandardScoreMathConceptsApplicationsTime1 0.99122
## StandardScoreLetterWordRecognitionTime1 0.75081
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2369 on 88 degrees of freedom
## (144 observations deleted due to missingness)
## Multiple R-squared: 0.1516, Adjusted R-squared: 0.1034
## F-statistic: 3.146 on 5 and 88 DF, p-value: 0.01167
#Controlling for school, only depression at T1 predicted depression at T4. Overall, the model predicted 10% of the variance in depression scores in S21
#anxiety
model2 <- lm(data = mydata1, CASI_ANX_S21 ~ SchoolCode2 + CASIANXF19 + CADHDCOMF19 + StandardScoreMathConceptsApplicationsTime1 + StandardScoreLetterWordRecognitionTime1)
summary(model2)
##
## Call:
## lm(formula = CASI_ANX_S21 ~ SchoolCode2 + CASIANXF19 + CADHDCOMF19 +
## StandardScoreMathConceptsApplicationsTime1 + StandardScoreLetterWordRecognitionTime1,
## data = mydata1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.61812 -0.22586 -0.02455 0.15456 1.12733
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 1.039602 0.368478 2.821
## SchoolCode2 -0.015010 0.025883 -0.580
## CASIANXF19 0.197124 0.092580 2.129
## CADHDCOMF19 0.223980 0.077177 2.902
## StandardScoreMathConceptsApplicationsTime1 -0.005636 0.003204 -1.759
## StandardScoreLetterWordRecognitionTime1 0.003530 0.003538 0.998
## Pr(>|t|)
## (Intercept) 0.00591 **
## SchoolCode2 0.56346
## CASIANXF19 0.03603 *
## CADHDCOMF19 0.00468 **
## StandardScoreMathConceptsApplicationsTime1 0.08205 .
## StandardScoreLetterWordRecognitionTime1 0.32118
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3275 on 88 degrees of freedom
## (144 observations deleted due to missingness)
## Multiple R-squared: 0.189, Adjusted R-squared: 0.1429
## F-statistic: 4.101 on 5 and 88 DF, p-value: 0.002149
#Controlling for school, anxiety at T1 and attention symptoms at T1 predicted anxiety at T4. Overall, the model predicted 14% of the variance in depression scores in S21.
#########################################################################################################
# LARGER DATASET HAS SOME DIFFERENT VARIABLE NAMES
#attention symptoms: CADHDCOM (adhd)
#standardized testing: KTEA_LiteracyF19 and KTEA_NumeracyF19
#depression: GlobalDepressionF19, GlobalDepressionS20, GlobalDepressionF20, GlobalDepressionS21
#anxiety: GlobalAnxietyF19, GlobalAnxietyS20, GlobalAnxietyF20, GlobalAnxietyS21
descriptives(mydata, vars = vars(KTEA_LiteracyF19, KTEA_NumeracyF19), missing = TRUE)
##
## DESCRIPTIVES
##
## Descriptives
## ──────────────────────────────────────────────────────────────
## KTEA_LiteracyF19 KTEA_NumeracyF19
## ──────────────────────────────────────────────────────────────
## N 199 200
## Missing 12 11
## Mean 100.0704 103.6300
## Median 100 103.0000
## Standard deviation 14.42623 15.07579
## Minimum 47 59
## Maximum 142 145
## ──────────────────────────────────────────────────────────────
descriptives(mydata, vars = vars(CADHDCOMF19,CADHDCOMS20, CADHDCOMF20, CADHDCOMS21), missing = TRUE)
##
## DESCRIPTIVES
##
## Descriptives
## ──────────────────────────────────────────────────────────────────────────────────
## CADHDCOMF19 CADHDCOMS20 CADHDCOMF20 CADHDCOMS21
## ──────────────────────────────────────────────────────────────────────────────────
## N 142 157 126 171
## Missing 69 54 85 40
## Mean 0.6387457 0.7395170 0.7268519 0.7852502
## Median 0.5555556 0.6666667 0.6111111 0.6666667
## Standard deviation 0.5321450 0.5212911 0.5361586 0.5486153
## Minimum 0.000000 0.000000 0.000000 0.000000
## Maximum 2.833333 2.944444 2.666667 2.666667
## ──────────────────────────────────────────────────────────────────────────────────
descriptives(mydata, vars = vars(GlobalDepressionF19, GlobalAnxietyF19), missing = TRUE)
##
## DESCRIPTIVES
##
## Descriptives
## ─────────────────────────────────────────────────────────────────
## GlobalDepressionF19 GlobalAnxietyF19
## ─────────────────────────────────────────────────────────────────
## N 147 147
## Missing 64 64
## Mean 0.1224490 0.3663211
## Median 0.000000 0.2857143
## Standard deviation 0.2401615 0.3659253
## Minimum 0.000000 0.000000
## Maximum 1.250000 2.000000
## ─────────────────────────────────────────────────────────────────
################################################################################################
# time-variant: attention symptoms at each time point (CADHDCOMF19, CADHDCOMS20, CADHDCOMF20, CADHDCOMS21)
# time-invariant: baseline academic scores: KTEA_LiteracyF19 and KTEA_NumeracyF19
# depression: GlobalDepressionF19, GlobalDepressionS20, GlobalDepressionF20, GlobalDepressionS21
#########################################################################################################
#unconditional model
u.dep <- '
Intercept =~ 1*GlobalDepressionF19 + 1*GlobalDepressionS20 + 1*GlobalDepressionF20 + 1*GlobalDepressionS21
Linear =~ 0*GlobalDepressionF19 + 1*GlobalDepressionS20 + 2*GlobalDepressionF20 + 3*GlobalDepressionS21'
u.dep.fit <- lavaan::growth(u.dep, data=mydata, missing = "fiml", estimator = "MLR")
lavaan::summary(u.dep.fit, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6.17 ended normally after 49 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 9
##
## Used Total
## Number of observations 207 211
## Number of missing patterns 15
##
## Model Test User Model:
## Standard Scaled
## Test Statistic 10.518 7.376
## Degrees of freedom 5 5
## P-value (Chi-square) 0.062 0.194
## Scaling correction factor 1.426
## Yuan-Bentler correction (Mplus variant)
##
## Model Test Baseline Model:
##
## Test statistic 136.941 118.318
## Degrees of freedom 6 6
## P-value 0.000 0.000
## Scaling correction factor 1.157
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.958 0.979
## Tucker-Lewis Index (TLI) 0.949 0.975
##
## Robust Comparative Fit Index (CFI) 0.987
## Robust Tucker-Lewis Index (TLI) 0.984
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -0.564 -0.564
## Scaling correction factor 2.533
## for the MLR correction
## Loglikelihood unrestricted model (H1) 4.694 4.694
## Scaling correction factor 2.138
## for the MLR correction
##
## Akaike (AIC) 19.129 19.129
## Bayesian (BIC) 49.123 49.123
## Sample-size adjusted Bayesian (SABIC) 20.607 20.607
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.073 0.048
## 90 Percent confidence interval - lower 0.000 0.000
## 90 Percent confidence interval - upper 0.135 0.105
## P-value H_0: RMSEA <= 0.050 0.223 0.460
## P-value H_0: RMSEA >= 0.080 0.487 0.208
##
## Robust RMSEA 0.056
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.191
## P-value H_0: Robust RMSEA <= 0.050 0.396
## P-value H_0: Robust RMSEA >= 0.080 0.479
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.057 0.057
##
## Parameter Estimates:
##
## Standard errors Sandwich
## Information bread Observed
## Observed information based on Hessian
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|)
## Intercept =~
## GloblDprssnF19 1.000
## GloblDprssnS20 1.000
## GloblDprssnF20 1.000
## GloblDprssnS21 1.000
## Linear =~
## GloblDprssnF19 0.000
## GloblDprssnS20 1.000
## GloblDprssnF20 2.000
## GloblDprssnS21 3.000
##
## Covariances:
## Estimate Std.Err z-value P(>|z|)
## Intercept ~~
## Linear 0.004 0.005 0.894 0.371
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|)
## Intercept 0.123 0.017 7.093 0.000
## Linear 0.020 0.008 2.542 0.011
##
## Variances:
## Estimate Std.Err z-value P(>|z|)
## .GloblDprssnF19 0.030 0.011 2.671 0.008
## .GloblDprssnS20 0.039 0.010 4.100 0.000
## .GloblDprssnF20 0.027 0.009 3.078 0.002
## .GloblDprssnS21 0.059 0.017 3.532 0.000
## Intercept 0.025 0.013 1.934 0.053
## Linear -0.000 0.002 -0.056 0.955
##
## R-Square:
## Estimate
## GloblDprssnF19 0.456
## GloblDprssnS20 0.464
## GloblDprssnF20 0.611
## GloblDprssnS21 0.460
#model fit thresholds
# RMSEA ≤ .06; 2) CFI ≥ .95; and 3) SRMR ≤ .08
#standardized estimates
standardizedSolution(u.dep.fit, type = "std.all", se = TRUE, pvalue = TRUE, ci = TRUE)
## lhs op rhs est.std se z pvalue
## 1 Intercept =~ GlobalDepressionF19 0.675 0.148 4.556 0.000
## 2 Intercept =~ GlobalDepressionS20 0.586 0.125 4.680 0.000
## 3 Intercept =~ GlobalDepressionF20 0.601 0.132 4.560 0.000
## 4 Intercept =~ GlobalDepressionS21 0.477 0.119 3.993 0.000
## 5 Linear =~ GlobalDepressionF19 NA NA NA NA
## 6 Linear =~ GlobalDepressionS20 NA NA NA NA
## 7 Linear =~ GlobalDepressionF20 NA NA NA NA
## 8 Linear =~ GlobalDepressionS21 NA NA NA NA
## 9 GlobalDepressionF19 ~~ GlobalDepressionF19 0.544 0.200 2.720 0.007
## 10 GlobalDepressionS20 ~~ GlobalDepressionS20 0.536 0.109 4.938 0.000
## 11 GlobalDepressionF20 ~~ GlobalDepressionF20 0.389 0.110 3.532 0.000
## 12 GlobalDepressionS21 ~~ GlobalDepressionS21 0.540 0.151 3.585 0.000
## 13 Intercept ~~ Intercept 1.000 0.000 NA NA
## 14 Linear ~~ Linear NA NA NA NA
## 15 Intercept ~~ Linear 2.389 19.058 0.125 0.900
## 16 GlobalDepressionF19 ~1 0.000 0.000 NA NA
## 17 GlobalDepressionS20 ~1 0.000 0.000 NA NA
## 18 GlobalDepressionF20 ~1 0.000 0.000 NA NA
## 19 GlobalDepressionS21 ~1 0.000 0.000 NA NA
## 20 Intercept ~1 0.778 0.162 4.803 0.000
## 21 Linear ~1 NA NA NA NA
## ci.lower ci.upper
## 1 0.385 0.966
## 2 0.340 0.831
## 3 0.343 0.859
## 4 0.243 0.711
## 5 NA NA
## 6 NA NA
## 7 NA NA
## 8 NA NA
## 9 0.152 0.936
## 10 0.323 0.749
## 11 0.173 0.604
## 12 0.245 0.835
## 13 1.000 1.000
## 14 NA NA
## 15 -34.964 39.743
## 16 0.000 0.000
## 17 0.000 0.000
## 18 0.000 0.000
## 19 0.000 0.000
## 20 0.461 1.096
## 21 NA NA
#unstandardized estimates
parameterEstimates(u.dep.fit)
## lhs op rhs est se z pvalue
## 1 Intercept =~ GlobalDepressionF19 1.000 0.000 NA NA
## 2 Intercept =~ GlobalDepressionS20 1.000 0.000 NA NA
## 3 Intercept =~ GlobalDepressionF20 1.000 0.000 NA NA
## 4 Intercept =~ GlobalDepressionS21 1.000 0.000 NA NA
## 5 Linear =~ GlobalDepressionF19 0.000 0.000 NA NA
## 6 Linear =~ GlobalDepressionS20 1.000 0.000 NA NA
## 7 Linear =~ GlobalDepressionF20 2.000 0.000 NA NA
## 8 Linear =~ GlobalDepressionS21 3.000 0.000 NA NA
## 9 GlobalDepressionF19 ~~ GlobalDepressionF19 0.030 0.011 2.671 0.008
## 10 GlobalDepressionS20 ~~ GlobalDepressionS20 0.039 0.010 4.100 0.000
## 11 GlobalDepressionF20 ~~ GlobalDepressionF20 0.027 0.009 3.078 0.002
## 12 GlobalDepressionS21 ~~ GlobalDepressionS21 0.059 0.017 3.532 0.000
## 13 Intercept ~~ Intercept 0.025 0.013 1.934 0.053
## 14 Linear ~~ Linear 0.000 0.002 -0.056 0.955
## 15 Intercept ~~ Linear 0.004 0.005 0.894 0.371
## 16 GlobalDepressionF19 ~1 0.000 0.000 NA NA
## 17 GlobalDepressionS20 ~1 0.000 0.000 NA NA
## 18 GlobalDepressionF20 ~1 0.000 0.000 NA NA
## 19 GlobalDepressionS21 ~1 0.000 0.000 NA NA
## 20 Intercept ~1 0.123 0.017 7.093 0.000
## 21 Linear ~1 0.020 0.008 2.542 0.011
## ci.lower ci.upper
## 1 1.000 1.000
## 2 1.000 1.000
## 3 1.000 1.000
## 4 1.000 1.000
## 5 0.000 0.000
## 6 1.000 1.000
## 7 2.000 2.000
## 8 3.000 3.000
## 9 0.008 0.052
## 10 0.020 0.058
## 11 0.010 0.044
## 12 0.026 0.092
## 13 0.000 0.050
## 14 -0.005 0.005
## 15 -0.005 0.014
## 16 0.000 0.000
## 17 0.000 0.000
## 18 0.000 0.000
## 19 0.000 0.000
## 20 0.089 0.157
## 21 0.005 0.036
#########################################################################################################
# conditional model
# with continuous covariates of attention regressed at each timepoint
# and baseline academic scores just on intercept & slope
#########################################################################################################
predict.model2 <- '
# latent growth factors
Intercept =~ 1*GlobalDepressionF19 + 1*GlobalDepressionS20 + 1*GlobalDepressionF20 + 1*GlobalDepressionS21
Linear =~ 0*GlobalDepressionF19 + 1*GlobalDepressionS20 + 2*GlobalDepressionF20 + 3*GlobalDepressionS21
# covariates
Intercept ~ CADHDCOMF19 + CADHDCOMS20 + CADHDCOMF20 + CADHDCOMS21 + KTEA_NumeracyF19 + KTEA_LiteracyF19
Linear ~ CADHDCOMF19 + CADHDCOMS20 + CADHDCOMF20 + CADHDCOMS21 + KTEA_NumeracyF19 + KTEA_LiteracyF19
# observed variables regressed on the time-varying covariate
GlobalDepressionF19 ~ CADHDCOMF19
GlobalDepressionS20 ~ CADHDCOMS20
GlobalDepressionF20 ~ CADHDCOMF20
GlobalDepressionS21 ~ CADHDCOMS21'
# fit prediction model to data
predict2 <- lavaan::growth(predict.model2, data=mydata, missing = "fiml", estimator = "MLR")
lavaan::summary(predict2, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6.17 ended normally after 82 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 25
##
## Used Total
## Number of observations 72 211
## Number of missing patterns 3
##
## Model Test User Model:
## Standard Scaled
## Test Statistic 19.303 18.282
## Degrees of freedom 13 13
## P-value (Chi-square) 0.114 0.147
## Scaling correction factor 1.056
## Yuan-Bentler correction (Mplus variant)
##
## Model Test Baseline Model:
##
## Test statistic 141.640 147.842
## Degrees of freedom 30 30
## P-value 0.000 0.000
## Scaling correction factor 0.958
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.944 0.955
## Tucker-Lewis Index (TLI) 0.870 0.897
##
## Robust Comparative Fit Index (CFI) 0.980
## Robust Tucker-Lewis Index (TLI) 0.954
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) 38.443 38.443
## Scaling correction factor 1.575
## for the MLR correction
## Loglikelihood unrestricted model (H1) 48.094 48.094
## Scaling correction factor 1.397
## for the MLR correction
##
## Akaike (AIC) -26.885 -26.885
## Bayesian (BIC) 30.031 30.031
## Sample-size adjusted Bayesian (SABIC) -48.735 -48.735
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.082 0.075
## 90 Percent confidence interval - lower 0.000 0.000
## 90 Percent confidence interval - upper 0.154 0.147
## P-value H_0: RMSEA <= 0.050 0.229 0.274
## P-value H_0: RMSEA >= 0.080 0.564 0.504
##
## Robust RMSEA 0.047
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.149
## P-value H_0: Robust RMSEA <= 0.050 0.461
## P-value H_0: Robust RMSEA >= 0.080 0.370
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.047 0.047
##
## Parameter Estimates:
##
## Standard errors Sandwich
## Information bread Observed
## Observed information based on Hessian
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|)
## Intercept =~
## GloblDprssnF19 1.000
## GloblDprssnS20 1.000
## GloblDprssnF20 1.000
## GloblDprssnS21 1.000
## Linear =~
## GloblDprssnF19 0.000
## GloblDprssnS20 1.000
## GloblDprssnF20 2.000
## GloblDprssnS21 3.000
##
## Regressions:
## Estimate Std.Err z-value P(>|z|)
## Intercept ~
## CADHDCOMF19 -0.031 0.121 -0.259 0.796
## CADHDCOMS20 -0.011 0.075 -0.148 0.882
## CADHDCOMF20 0.131 0.083 1.580 0.114
## CADHDCOMS21 -0.019 0.074 -0.258 0.797
## KTEA_NumrcyF19 0.005 0.002 2.185 0.029
## KTEA_LitrcyF19 -0.004 0.002 -2.154 0.031
## Linear ~
## CADHDCOMF19 0.054 0.059 0.918 0.359
## CADHDCOMS20 -0.032 0.041 -0.783 0.434
## CADHDCOMF20 -0.078 0.044 -1.769 0.077
## CADHDCOMS21 0.060 0.041 1.483 0.138
## KTEA_NumrcyF19 -0.001 0.001 -0.736 0.462
## KTEA_LitrcyF19 0.001 0.001 1.070 0.285
## GlobalDepressionF19 ~
## CADHDCOMF19 0.025 0.128 0.197 0.844
## GlobalDepressionS20 ~
## CADHDCOMS20 0.176 0.104 1.698 0.090
## GlobalDepressionF20 ~
## CADHDCOMF20 0.188 0.107 1.766 0.077
## GlobalDepressionS21 ~
## CADHDCOMS21 0.229 0.125 1.833 0.067
##
## Covariances:
## Estimate Std.Err z-value P(>|z|)
## .Intercept ~~
## .Linear 0.003 0.005 0.633 0.527
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|)
## .Intercept -0.148 0.203 -0.731 0.465
## .Linear -0.030 0.074 -0.401 0.689
##
## Variances:
## Estimate Std.Err z-value P(>|z|)
## .GloblDprssnF19 0.015 0.011 1.379 0.168
## .GloblDprssnS20 0.034 0.009 3.916 0.000
## .GloblDprssnF20 0.055 0.017 3.164 0.002
## .GloblDprssnS21 0.070 0.029 2.436 0.015
## .Intercept 0.011 0.010 1.101 0.271
## .Linear -0.003 0.003 -0.877 0.380
##
## R-Square:
## Estimate
## GloblDprssnF19 0.551
## GloblDprssnS20 0.491
## GloblDprssnF20 0.362
## GloblDprssnS21 0.344
## Intercept 0.325
## Linear NA
#model fit thresholds
# RMSEA ≤ .06; 2) CFI ≥ .95; and 3) SRMR ≤ .08
#standardized estimates
standardizedSolution(predict2, type = "std.all", se = TRUE, pvalue = TRUE, ci = TRUE)
## lhs op rhs est.std se z pvalue
## 1 Intercept =~ GlobalDepressionF19 0.721 0.241 2.999 0.003
## 2 Intercept =~ GlobalDepressionS20 0.498 0.174 2.863 0.004
## 3 Intercept =~ GlobalDepressionF20 0.440 0.160 2.758 0.006
## 4 Intercept =~ GlobalDepressionS21 0.395 0.152 2.609 0.009
## 5 Linear =~ GlobalDepressionF19 NA NA NA NA
## 6 Linear =~ GlobalDepressionS20 NA NA NA NA
## 7 Linear =~ GlobalDepressionF20 NA NA NA NA
## 8 Linear =~ GlobalDepressionS21 NA NA NA NA
## 9 Intercept ~ CADHDCOMF19 -0.117 0.476 -0.246 0.806
## 10 Intercept ~ CADHDCOMS20 -0.044 0.298 -0.149 0.882
## 11 Intercept ~ CADHDCOMF20 0.496 0.339 1.465 0.143
## 12 Intercept ~ CADHDCOMS21 -0.080 0.318 -0.252 0.801
## 13 Intercept ~ KTEA_NumeracyF19 0.605 0.280 2.159 0.031
## 14 Intercept ~ KTEA_LiteracyF19 -0.415 0.222 -1.867 0.062
## 15 Linear ~ CADHDCOMF19 NA NA NA NA
## 16 Linear ~ CADHDCOMS20 NA NA NA NA
## 17 Linear ~ CADHDCOMF20 NA NA NA NA
## 18 Linear ~ CADHDCOMS21 NA NA NA NA
## 19 Linear ~ KTEA_NumeracyF19 NA NA NA NA
## 20 Linear ~ KTEA_LiteracyF19 NA NA NA NA
## 21 GlobalDepressionF19 ~ CADHDCOMF19 0.068 0.345 0.198 0.843
## 22 GlobalDepressionS20 ~ CADHDCOMS20 0.350 0.192 1.820 0.069
## 23 GlobalDepressionF20 ~ CADHDCOMF20 0.313 0.174 1.794 0.073
## 24 GlobalDepressionS21 ~ CADHDCOMS21 0.383 0.205 1.864 0.062
## 25 GlobalDepressionF19 ~~ GlobalDepressionF19 0.449 0.320 1.404 0.160
## 26 GlobalDepressionS20 ~~ GlobalDepressionS20 0.509 0.116 4.394 0.000
## 27 GlobalDepressionF20 ~~ GlobalDepressionF20 0.638 0.176 3.620 0.000
## 28 GlobalDepressionS21 ~~ GlobalDepressionS21 0.656 0.224 2.927 0.003
## 29 Intercept ~~ Intercept 0.675 0.277 2.436 0.015
## 30 Linear ~~ Linear NA NA NA NA
## 31 Intercept ~~ Linear 0.547 0.820 0.667 0.505
## 32 CADHDCOMF19 ~~ CADHDCOMF19 1.000 0.000 NA NA
## 33 CADHDCOMF19 ~~ CADHDCOMS20 0.770 0.000 NA NA
## 34 CADHDCOMF19 ~~ CADHDCOMF20 0.818 0.000 NA NA
## 35 CADHDCOMF19 ~~ CADHDCOMS21 0.764 0.000 NA NA
## 36 CADHDCOMF19 ~~ KTEA_NumeracyF19 0.032 0.000 NA NA
## 37 CADHDCOMF19 ~~ KTEA_LiteracyF19 -0.133 0.000 NA NA
## 38 CADHDCOMS20 ~~ CADHDCOMS20 1.000 0.000 NA NA
## 39 CADHDCOMS20 ~~ CADHDCOMF20 0.862 0.000 NA NA
## 40 CADHDCOMS20 ~~ CADHDCOMS21 0.882 0.000 NA NA
## 41 CADHDCOMS20 ~~ KTEA_NumeracyF19 -0.116 0.000 NA NA
## 42 CADHDCOMS20 ~~ KTEA_LiteracyF19 -0.249 0.000 NA NA
## 43 CADHDCOMF20 ~~ CADHDCOMF20 1.000 0.000 NA NA
## 44 CADHDCOMF20 ~~ CADHDCOMS21 0.858 0.000 NA NA
## 45 CADHDCOMF20 ~~ KTEA_NumeracyF19 -0.138 0.000 NA NA
## 46 CADHDCOMF20 ~~ KTEA_LiteracyF19 -0.226 0.000 NA NA
## 47 CADHDCOMS21 ~~ CADHDCOMS21 1.000 0.000 NA NA
## 48 CADHDCOMS21 ~~ KTEA_NumeracyF19 -0.134 0.000 NA NA
## 49 CADHDCOMS21 ~~ KTEA_LiteracyF19 -0.229 0.000 NA NA
## 50 KTEA_NumeracyF19 ~~ KTEA_NumeracyF19 1.000 0.000 NA NA
## 51 KTEA_NumeracyF19 ~~ KTEA_LiteracyF19 0.592 0.000 NA NA
## 52 KTEA_LiteracyF19 ~~ KTEA_LiteracyF19 1.000 0.000 NA NA
## 53 GlobalDepressionF19 ~1 0.000 0.000 NA NA
## 54 GlobalDepressionS20 ~1 0.000 0.000 NA NA
## 55 GlobalDepressionF20 ~1 0.000 0.000 NA NA
## 56 GlobalDepressionS21 ~1 0.000 0.000 NA NA
## 57 CADHDCOMF19 ~1 1.122 0.000 NA NA
## 58 CADHDCOMS20 ~1 1.282 0.000 NA NA
## 59 CADHDCOMF20 ~1 1.300 0.000 NA NA
## 60 CADHDCOMS21 ~1 1.297 0.000 NA NA
## 61 KTEA_NumeracyF19 ~1 7.158 0.000 NA NA
## 62 KTEA_LiteracyF19 ~1 7.468 0.000 NA NA
## 63 Intercept ~1 -1.145 1.458 -0.785 0.432
## 64 Linear ~1 NA NA NA NA
## ci.lower ci.upper
## 1 0.250 1.193
## 2 0.157 0.839
## 3 0.127 0.754
## 4 0.098 0.692
## 5 NA NA
## 6 NA NA
## 7 NA NA
## 8 NA NA
## 9 -1.050 0.816
## 10 -0.628 0.539
## 11 -0.168 1.160
## 12 -0.704 0.544
## 13 0.056 1.155
## 14 -0.850 0.021
## 15 NA NA
## 16 NA NA
## 17 NA NA
## 18 NA NA
## 19 NA NA
## 20 NA NA
## 21 -0.608 0.744
## 22 -0.027 0.727
## 23 -0.029 0.654
## 24 -0.020 0.785
## 25 -0.178 1.076
## 26 0.282 0.737
## 27 0.292 0.983
## 28 0.217 1.095
## 29 0.132 1.219
## 30 NA NA
## 31 -1.060 2.155
## 32 1.000 1.000
## 33 0.770 0.770
## 34 0.818 0.818
## 35 0.764 0.764
## 36 0.032 0.032
## 37 -0.133 -0.133
## 38 1.000 1.000
## 39 0.862 0.862
## 40 0.882 0.882
## 41 -0.116 -0.116
## 42 -0.249 -0.249
## 43 1.000 1.000
## 44 0.858 0.858
## 45 -0.138 -0.138
## 46 -0.226 -0.226
## 47 1.000 1.000
## 48 -0.134 -0.134
## 49 -0.229 -0.229
## 50 1.000 1.000
## 51 0.592 0.592
## 52 1.000 1.000
## 53 0.000 0.000
## 54 0.000 0.000
## 55 0.000 0.000
## 56 0.000 0.000
## 57 1.122 1.122
## 58 1.282 1.282
## 59 1.300 1.300
## 60 1.297 1.297
## 61 7.158 7.158
## 62 7.468 7.468
## 63 -4.002 1.712
## 64 NA NA
#unstandardized estimates
parameterEstimates(predict2)
## lhs op rhs est se z pvalue
## 1 Intercept =~ GlobalDepressionF19 1.000 0.000 NA NA
## 2 Intercept =~ GlobalDepressionS20 1.000 0.000 NA NA
## 3 Intercept =~ GlobalDepressionF20 1.000 0.000 NA NA
## 4 Intercept =~ GlobalDepressionS21 1.000 0.000 NA NA
## 5 Linear =~ GlobalDepressionF19 0.000 0.000 NA NA
## 6 Linear =~ GlobalDepressionS20 1.000 0.000 NA NA
## 7 Linear =~ GlobalDepressionF20 2.000 0.000 NA NA
## 8 Linear =~ GlobalDepressionS21 3.000 0.000 NA NA
## 9 Intercept ~ CADHDCOMF19 -0.031 0.121 -0.259 0.796
## 10 Intercept ~ CADHDCOMS20 -0.011 0.075 -0.148 0.882
## 11 Intercept ~ CADHDCOMF20 0.131 0.083 1.580 0.114
## 12 Intercept ~ CADHDCOMS21 -0.019 0.074 -0.258 0.797
## 13 Intercept ~ KTEA_NumeracyF19 0.005 0.002 2.185 0.029
## 14 Intercept ~ KTEA_LiteracyF19 -0.004 0.002 -2.154 0.031
## 15 Linear ~ CADHDCOMF19 0.054 0.059 0.918 0.359
## 16 Linear ~ CADHDCOMS20 -0.032 0.041 -0.783 0.434
## 17 Linear ~ CADHDCOMF20 -0.078 0.044 -1.769 0.077
## 18 Linear ~ CADHDCOMS21 0.060 0.041 1.483 0.138
## 19 Linear ~ KTEA_NumeracyF19 -0.001 0.001 -0.736 0.462
## 20 Linear ~ KTEA_LiteracyF19 0.001 0.001 1.070 0.285
## 21 GlobalDepressionF19 ~ CADHDCOMF19 0.025 0.128 0.197 0.844
## 22 GlobalDepressionS20 ~ CADHDCOMS20 0.176 0.104 1.698 0.090
## 23 GlobalDepressionF20 ~ CADHDCOMF20 0.188 0.107 1.766 0.077
## 24 GlobalDepressionS21 ~ CADHDCOMS21 0.229 0.125 1.833 0.067
## 25 GlobalDepressionF19 ~~ GlobalDepressionF19 0.015 0.011 1.379 0.168
## 26 GlobalDepressionS20 ~~ GlobalDepressionS20 0.034 0.009 3.916 0.000
## 27 GlobalDepressionF20 ~~ GlobalDepressionF20 0.055 0.017 3.164 0.002
## 28 GlobalDepressionS21 ~~ GlobalDepressionS21 0.070 0.029 2.436 0.015
## 29 Intercept ~~ Intercept 0.011 0.010 1.101 0.271
## 30 Linear ~~ Linear -0.003 0.003 -0.877 0.380
## 31 Intercept ~~ Linear 0.003 0.005 0.633 0.527
## 32 CADHDCOMF19 ~~ CADHDCOMF19 0.235 0.000 NA NA
## 33 CADHDCOMF19 ~~ CADHDCOMS20 0.194 0.000 NA NA
## 34 CADHDCOMF19 ~~ CADHDCOMF20 0.194 0.000 NA NA
## 35 CADHDCOMF19 ~~ CADHDCOMS21 0.203 0.000 NA NA
## 36 CADHDCOMF19 ~~ KTEA_NumeracyF19 0.223 0.000 NA NA
## 37 CADHDCOMF19 ~~ KTEA_LiteracyF19 -0.873 0.000 NA NA
## 38 CADHDCOMS20 ~~ CADHDCOMS20 0.269 0.000 NA NA
## 39 CADHDCOMS20 ~~ CADHDCOMF20 0.218 0.000 NA NA
## 40 CADHDCOMS20 ~~ CADHDCOMS21 0.251 0.000 NA NA
## 41 CADHDCOMS20 ~~ KTEA_NumeracyF19 -0.867 0.000 NA NA
## 42 CADHDCOMS20 ~~ KTEA_LiteracyF19 -1.742 0.000 NA NA
## 43 CADHDCOMF20 ~~ CADHDCOMF20 0.239 0.000 NA NA
## 44 CADHDCOMF20 ~~ CADHDCOMS21 0.230 0.000 NA NA
## 45 CADHDCOMF20 ~~ KTEA_NumeracyF19 -0.972 0.000 NA NA
## 46 CADHDCOMF20 ~~ KTEA_LiteracyF19 -1.495 0.000 NA NA
## 47 CADHDCOMS21 ~~ CADHDCOMS21 0.301 0.000 NA NA
## 48 CADHDCOMS21 ~~ KTEA_NumeracyF19 -1.064 0.000 NA NA
## 49 CADHDCOMS21 ~~ KTEA_LiteracyF19 -1.700 0.000 NA NA
## 50 KTEA_NumeracyF19 ~~ KTEA_NumeracyF19 208.329 0.000 NA NA
## 51 KTEA_NumeracyF19 ~~ KTEA_LiteracyF19 115.354 0.000 NA NA
## 52 KTEA_LiteracyF19 ~~ KTEA_LiteracyF19 182.212 0.000 NA NA
## 53 GlobalDepressionF19 ~1 0.000 0.000 NA NA
## 54 GlobalDepressionS20 ~1 0.000 0.000 NA NA
## 55 GlobalDepressionF20 ~1 0.000 0.000 NA NA
## 56 GlobalDepressionS21 ~1 0.000 0.000 NA NA
## 57 CADHDCOMF19 ~1 0.544 0.000 NA NA
## 58 CADHDCOMS20 ~1 0.664 0.000 NA NA
## 59 CADHDCOMF20 ~1 0.636 0.000 NA NA
## 60 CADHDCOMS21 ~1 0.711 0.000 NA NA
## 61 KTEA_NumeracyF19 ~1 103.319 0.000 NA NA
## 62 KTEA_LiteracyF19 ~1 100.806 0.000 NA NA
## 63 Intercept ~1 -0.148 0.203 -0.731 0.465
## 64 Linear ~1 -0.030 0.074 -0.401 0.689
## ci.lower ci.upper
## 1 1.000 1.000
## 2 1.000 1.000
## 3 1.000 1.000
## 4 1.000 1.000
## 5 0.000 0.000
## 6 1.000 1.000
## 7 2.000 2.000
## 8 3.000 3.000
## 9 -0.269 0.206
## 10 -0.158 0.136
## 11 -0.032 0.294
## 12 -0.163 0.125
## 13 0.001 0.010
## 14 -0.008 0.000
## 15 -0.061 0.169
## 16 -0.111 0.048
## 17 -0.164 0.008
## 18 -0.019 0.140
## 19 -0.003 0.001
## 20 -0.001 0.002
## 21 -0.226 0.277
## 22 -0.027 0.379
## 23 -0.021 0.397
## 24 -0.016 0.473
## 25 -0.006 0.035
## 26 0.017 0.052
## 27 0.021 0.089
## 28 0.014 0.127
## 29 -0.009 0.032
## 30 -0.009 0.004
## 31 -0.007 0.013
## 32 0.235 0.235
## 33 0.194 0.194
## 34 0.194 0.194
## 35 0.203 0.203
## 36 0.223 0.223
## 37 -0.873 -0.873
## 38 0.269 0.269
## 39 0.218 0.218
## 40 0.251 0.251
## 41 -0.867 -0.867
## 42 -1.742 -1.742
## 43 0.239 0.239
## 44 0.230 0.230
## 45 -0.972 -0.972
## 46 -1.495 -1.495
## 47 0.301 0.301
## 48 -1.064 -1.064
## 49 -1.700 -1.700
## 50 208.329 208.329
## 51 115.354 115.354
## 52 182.212 182.212
## 53 0.000 0.000
## 54 0.000 0.000
## 55 0.000 0.000
## 56 0.000 0.000
## 57 0.544 0.544
## 58 0.664 0.664
## 59 0.636 0.636
## 60 0.711 0.711
## 61 103.319 103.319
## 62 100.806 100.806
## 63 -0.546 0.250
## 64 -0.175 0.115
semPaths(predict2,what = "path", whatLabels = "est", edge.label.cex=.7,
intercepts = TRUE, edge.color = "black",shapeInt = "circle",
nCharNodes = 0, nCharEdges=0, sizeLat = 6, sizeMan=9, exoVar = FALSE,
exoCov = FALSE, covAtResiduals = FALSE)

# the mean for the intercept factor is the average depression score at T1, and its variance
# is the random variation around this mean initial level. The linear factor mean is the average amount
# of increase in depression per time point, which is assumed to be the same between all pairs of adjacent
# measurement occasions
# anxiety: GlobalAnxietyF19, GlobalAnxietyS20, GlobalAnxietyF20, GlobalAnxietyS21
#########################################################################################################
#unconditional model
u.anx <- '
Intercept =~ 1*GlobalAnxietyF19 + 1*GlobalAnxietyS20 + 1*GlobalAnxietyF20 + 1*GlobalAnxietyS21
Linear =~ 0*GlobalAnxietyF19 + 1*GlobalAnxietyS20 + 2*GlobalAnxietyF20 + 3*GlobalAnxietyS21'
u.anx.fit <- lavaan::growth(u.anx, data=mydata, missing = "fiml", estimator = "MLR")
lavaan::summary(u.anx.fit, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6.17 ended normally after 39 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 9
##
## Used Total
## Number of observations 207 211
## Number of missing patterns 15
##
## Model Test User Model:
## Standard Scaled
## Test Statistic 11.357 8.128
## Degrees of freedom 5 5
## P-value (Chi-square) 0.045 0.149
## Scaling correction factor 1.397
## Yuan-Bentler correction (Mplus variant)
##
## Model Test Baseline Model:
##
## Test statistic 255.083 201.337
## Degrees of freedom 6 6
## P-value 0.000 0.000
## Scaling correction factor 1.267
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.974 0.984
## Tucker-Lewis Index (TLI) 0.969 0.981
##
## Robust Comparative Fit Index (CFI) 0.973
## Robust Tucker-Lewis Index (TLI) 0.968
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -117.337 -117.337
## Scaling correction factor 1.777
## for the MLR correction
## Loglikelihood unrestricted model (H1) -111.658 -111.658
## Scaling correction factor 1.641
## for the MLR correction
##
## Akaike (AIC) 252.673 252.673
## Bayesian (BIC) 282.668 282.668
## Sample-size adjusted Bayesian (SABIC) 254.152 254.152
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.078 0.055
## 90 Percent confidence interval - lower 0.011 0.000
## 90 Percent confidence interval - upper 0.140 0.111
## P-value H_0: RMSEA <= 0.050 0.181 0.384
## P-value H_0: RMSEA >= 0.080 0.543 0.268
##
## Robust RMSEA 0.099
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.195
## P-value H_0: Robust RMSEA <= 0.050 0.175
## P-value H_0: Robust RMSEA >= 0.080 0.686
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.037 0.037
##
## Parameter Estimates:
##
## Standard errors Sandwich
## Information bread Observed
## Observed information based on Hessian
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|)
## Intercept =~
## GlobalAnxtyF19 1.000
## GlobalAnxtyS20 1.000
## GlobalAnxtyF20 1.000
## GlobalAnxtyS21 1.000
## Linear =~
## GlobalAnxtyF19 0.000
## GlobalAnxtyS20 1.000
## GlobalAnxtyF20 2.000
## GlobalAnxtyS21 3.000
##
## Covariances:
## Estimate Std.Err z-value P(>|z|)
## Intercept ~~
## Linear -0.000 0.006 -0.003 0.998
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|)
## Intercept 0.356 0.024 14.535 0.000
## Linear 0.014 0.009 1.576 0.115
##
## Variances:
## Estimate Std.Err z-value P(>|z|)
## .GlobalAnxtyF19 0.055 0.014 3.949 0.000
## .GlobalAnxtyS20 0.044 0.010 4.412 0.000
## .GlobalAnxtyF20 0.027 0.008 3.450 0.001
## .GlobalAnxtyS21 0.067 0.019 3.576 0.000
## Intercept 0.071 0.019 3.697 0.000
## Linear 0.002 0.003 0.582 0.560
##
## R-Square:
## Estimate
## GlobalAnxtyF19 0.561
## GlobalAnxtyS20 0.622
## GlobalAnxtyF20 0.743
## GlobalAnxtyS21 0.559
#model fit thresholds
# RMSEA ≤ .06; 2) CFI ≥ .95; and 3) SRMR ≤ .08
#standardized estimates
standardizedSolution(u.anx.fit, type = "std.all", se = TRUE, pvalue = TRUE, ci = TRUE)
## lhs op rhs est.std se z pvalue ci.lower
## 1 Intercept =~ GlobalAnxietyF19 0.749 0.064 11.712 0.000 0.623
## 2 Intercept =~ GlobalAnxietyS20 0.780 0.082 9.531 0.000 0.620
## 3 Intercept =~ GlobalAnxietyF20 0.827 0.095 8.717 0.000 0.641
## 4 Intercept =~ GlobalAnxietyS21 0.685 0.102 6.699 0.000 0.484
## 5 Linear =~ GlobalAnxietyF19 0.000 0.000 NA NA 0.000
## 6 Linear =~ GlobalAnxietyS20 0.115 0.101 1.136 0.256 -0.083
## 7 Linear =~ GlobalAnxietyF20 0.243 0.212 1.147 0.251 -0.172
## 8 Linear =~ GlobalAnxietyS21 0.302 0.269 1.122 0.262 -0.226
## 9 GlobalAnxietyF19 ~~ GlobalAnxietyF19 0.439 0.096 4.589 0.000 0.252
## 10 GlobalAnxietyS20 ~~ GlobalAnxietyS20 0.378 0.063 6.037 0.000 0.256
## 11 GlobalAnxietyF20 ~~ GlobalAnxietyF20 0.257 0.074 3.491 0.000 0.113
## 12 GlobalAnxietyS21 ~~ GlobalAnxietyS21 0.441 0.088 5.023 0.000 0.269
## 13 Intercept ~~ Intercept 1.000 0.000 NA NA 1.000
## 14 Linear ~~ Linear 1.000 0.000 NA NA 1.000
## 15 Intercept ~~ Linear -0.002 0.568 -0.003 0.998 -1.116
## 16 GlobalAnxietyF19 ~1 0.000 0.000 NA NA 0.000
## 17 GlobalAnxietyS20 ~1 0.000 0.000 NA NA 0.000
## 18 GlobalAnxietyF20 ~1 0.000 0.000 NA NA 0.000
## 19 GlobalAnxietyS21 ~1 0.000 0.000 NA NA 0.000
## 20 Intercept ~1 1.337 0.158 8.474 0.000 1.028
## 21 Linear ~1 0.369 0.425 0.868 0.385 -0.464
## ci.upper
## 1 0.874
## 2 0.941
## 3 1.014
## 4 0.885
## 5 0.000
## 6 0.312
## 7 0.659
## 8 0.829
## 9 0.627
## 10 0.501
## 11 0.401
## 12 0.613
## 13 1.000
## 14 1.000
## 15 1.112
## 16 0.000
## 17 0.000
## 18 0.000
## 19 0.000
## 20 1.646
## 21 1.201
#########################################################################################################
# conditional model
# with continuous covariates of attention regressed at each timepoint
# and baseline academic scores just on intercept & slope
#########################################################################################################
predict.model4 <- '
# latent growth factors
Intercept =~ 1*GlobalAnxietyF19 + 1*GlobalAnxietyS20 + 1*GlobalAnxietyF20 + 1*GlobalAnxietyS21
Linear =~ 0*GlobalAnxietyF19 + 1*GlobalAnxietyS20 + 2*GlobalAnxietyF20 + 3*GlobalAnxietyS21
# covariates
Intercept ~ CADHDCOMF19 + CADHDCOMS20 + CADHDCOMF20 + CADHDCOMS21 + KTEA_NumeracyF19 + KTEA_LiteracyF19
Linear ~ CADHDCOMF19 + CADHDCOMS20 + CADHDCOMF20 + CADHDCOMS21 + KTEA_NumeracyF19 + KTEA_LiteracyF19
# observed variables regressed on the time-varying covariate
GlobalAnxietyF19 ~ CADHDCOMF19
GlobalAnxietyS20 ~ CADHDCOMS20
GlobalAnxietyF20 ~ CADHDCOMF20
GlobalAnxietyS21 ~ CADHDCOMS21'
# fit prediction model to data
predict4 <- lavaan::growth(predict.model4, data=mydata, missing = "fiml", estimator = "ml")
lavaan::summary(predict4, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6.17 ended normally after 82 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 25
##
## Used Total
## Number of observations 72 211
## Number of missing patterns 3
##
## Model Test User Model:
##
## Test statistic 20.147
## Degrees of freedom 13
## P-value (Chi-square) 0.092
##
## Model Test Baseline Model:
##
## Test statistic 246.073
## Degrees of freedom 30
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.967
## Tucker-Lewis Index (TLI) 0.924
##
## Robust Comparative Fit Index (CFI) 0.951
## Robust Tucker-Lewis Index (TLI) 0.888
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -18.683
## Loglikelihood unrestricted model (H1) -8.609
##
## Akaike (AIC) 87.366
## Bayesian (BIC) 144.283
## Sample-size adjusted Bayesian (SABIC) 65.516
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.087
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.158
## P-value H_0: RMSEA <= 0.050 0.194
## P-value H_0: RMSEA >= 0.080 0.609
##
## Robust RMSEA 0.109
## 90 Percent confidence interval - lower 0.026
## 90 Percent confidence interval - upper 0.178
## P-value H_0: Robust RMSEA <= 0.050 0.093
## P-value H_0: Robust RMSEA >= 0.080 0.773
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.032
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Observed
## Observed information based on Hessian
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|)
## Intercept =~
## GlobalAnxtyF19 1.000
## GlobalAnxtyS20 1.000
## GlobalAnxtyF20 1.000
## GlobalAnxtyS21 1.000
## Linear =~
## GlobalAnxtyF19 0.000
## GlobalAnxtyS20 1.000
## GlobalAnxtyF20 2.000
## GlobalAnxtyS21 3.000
##
## Regressions:
## Estimate Std.Err z-value P(>|z|)
## Intercept ~
## CADHDCOMF19 0.007 0.186 0.039 0.969
## CADHDCOMS20 0.089 0.172 0.517 0.605
## CADHDCOMF20 0.337 0.182 1.852 0.064
## CADHDCOMS21 -0.029 0.158 -0.181 0.857
## KTEA_NumrcyF19 0.003 0.003 0.911 0.362
## KTEA_LitrcyF19 -0.002 0.003 -0.527 0.598
## Linear ~
## CADHDCOMF19 0.027 0.071 0.378 0.705
## CADHDCOMS20 -0.047 0.056 -0.846 0.397
## CADHDCOMF20 -0.153 0.062 -2.453 0.014
## CADHDCOMS21 0.070 0.059 1.172 0.241
## KTEA_NumrcyF19 -0.002 0.001 -1.759 0.079
## KTEA_LitrcyF19 0.001 0.001 0.931 0.352
## GlobalAnxietyF19 ~
## CADHDCOMF19 0.092 0.160 0.573 0.566
## GlobalAnxietyS20 ~
## CADHDCOMS20 0.136 0.091 1.492 0.136
## GlobalAnxietyF20 ~
## CADHDCOMF20 0.215 0.097 2.212 0.027
## GlobalAnxietyS21 ~
## CADHDCOMS21 0.311 0.135 2.297 0.022
##
## Covariances:
## Estimate Std.Err z-value P(>|z|)
## .Intercept ~~
## .Linear -0.002 0.005 -0.342 0.732
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|)
## .Intercept -0.071 0.335 -0.211 0.833
## .Linear 0.107 0.109 0.981 0.326
##
## Variances:
## Estimate Std.Err z-value P(>|z|)
## .GlobalAnxtyF19 0.037 0.013 2.774 0.006
## .GlobalAnxtyS20 0.056 0.012 4.785 0.000
## .GlobalAnxtyF20 0.020 0.006 3.100 0.002
## .GlobalAnxtyS21 0.058 0.012 4.640 0.000
## .Intercept 0.063 0.018 3.537 0.000
## .Linear 0.001 0.002 0.285 0.775
##
## R-Square:
## Estimate
## GlobalAnxtyF19 0.763
## GlobalAnxtyS20 0.653
## GlobalAnxtyF20 0.833
## GlobalAnxtyS21 0.659
## Intercept 0.382
## Linear 0.841
#standardized estimates
standardizedSolution(predict4, type = "std.all", se = TRUE, pvalue = TRUE, ci = TRUE)
## lhs op rhs est.std se z pvalue ci.lower
## 1 Intercept =~ GlobalAnxietyF19 0.810 0.117 6.930 0.000 0.581
## 2 Intercept =~ GlobalAnxietyS20 0.800 0.121 6.602 0.000 0.562
## 3 Intercept =~ GlobalAnxietyF20 0.934 0.143 6.532 0.000 0.654
## 4 Intercept =~ GlobalAnxietyS21 0.778 0.134 5.824 0.000 0.516
## 5 Linear =~ GlobalAnxietyF19 0.000 0.000 NA NA 0.000
## 6 Linear =~ GlobalAnxietyS20 0.161 0.085 1.903 0.057 -0.005
## 7 Linear =~ GlobalAnxietyF20 0.376 0.199 1.893 0.058 -0.013
## 8 Linear =~ GlobalAnxietyS21 0.470 0.248 1.896 0.058 -0.016
## 9 Intercept ~ CADHDCOMF19 0.011 0.281 0.039 0.969 -0.540
## 10 Intercept ~ CADHDCOMS20 0.144 0.275 0.523 0.601 -0.395
## 11 Intercept ~ CADHDCOMF20 0.514 0.280 1.836 0.066 -0.035
## 12 Intercept ~ CADHDCOMS21 -0.049 0.272 -0.180 0.857 -0.581
## 13 Intercept ~ KTEA_NumeracyF19 0.135 0.147 0.916 0.360 -0.154
## 14 Intercept ~ KTEA_LiteracyF19 -0.077 0.145 -0.529 0.597 -0.361
## 15 Linear ~ CADHDCOMF19 0.203 0.595 0.342 0.732 -0.962
## 16 Linear ~ CADHDCOMS20 -0.380 0.462 -0.822 0.411 -1.286
## 17 Linear ~ CADHDCOMF20 -1.162 0.683 -1.702 0.089 -2.501
## 18 Linear ~ CADHDCOMS21 0.593 0.649 0.914 0.361 -0.679
## 19 Linear ~ KTEA_NumeracyF19 -0.425 0.303 -1.400 0.161 -1.019
## 20 Linear ~ KTEA_LiteracyF19 0.218 0.252 0.865 0.387 -0.275
## 21 GlobalAnxietyF19 ~ CADHDCOMF19 0.112 0.196 0.574 0.566 -0.271
## 22 GlobalAnxietyS20 ~ CADHDCOMS20 0.176 0.117 1.501 0.133 -0.054
## 23 GlobalAnxietyF20 ~ CADHDCOMF20 0.307 0.140 2.192 0.028 0.032
## 24 GlobalAnxietyS21 ~ CADHDCOMS21 0.414 0.177 2.333 0.020 0.066
## 25 GlobalAnxietyF19 ~~ GlobalAnxietyF19 0.237 0.087 2.712 0.007 0.066
## 26 GlobalAnxietyS20 ~~ GlobalAnxietyS20 0.347 0.064 5.376 0.000 0.220
## 27 GlobalAnxietyF20 ~~ GlobalAnxietyF20 0.167 0.052 3.198 0.001 0.065
## 28 GlobalAnxietyS21 ~~ GlobalAnxietyS21 0.341 0.072 4.757 0.000 0.201
## 29 Intercept ~~ Intercept 0.618 0.185 3.346 0.001 0.256
## 30 Linear ~~ Linear 0.159 0.483 0.330 0.741 -0.787
## 31 Intercept ~~ Linear -0.287 0.512 -0.560 0.575 -1.290
## 32 CADHDCOMF19 ~~ CADHDCOMF19 1.000 0.000 NA NA 1.000
## 33 CADHDCOMF19 ~~ CADHDCOMS20 0.770 0.000 NA NA 0.770
## 34 CADHDCOMF19 ~~ CADHDCOMF20 0.818 0.000 NA NA 0.818
## 35 CADHDCOMF19 ~~ CADHDCOMS21 0.764 0.000 NA NA 0.764
## 36 CADHDCOMF19 ~~ KTEA_NumeracyF19 0.032 0.000 NA NA 0.032
## 37 CADHDCOMF19 ~~ KTEA_LiteracyF19 -0.133 0.000 NA NA -0.133
## 38 CADHDCOMS20 ~~ CADHDCOMS20 1.000 0.000 NA NA 1.000
## 39 CADHDCOMS20 ~~ CADHDCOMF20 0.862 0.000 NA NA 0.862
## 40 CADHDCOMS20 ~~ CADHDCOMS21 0.882 0.000 NA NA 0.882
## 41 CADHDCOMS20 ~~ KTEA_NumeracyF19 -0.116 0.000 NA NA -0.116
## 42 CADHDCOMS20 ~~ KTEA_LiteracyF19 -0.249 0.000 NA NA -0.249
## 43 CADHDCOMF20 ~~ CADHDCOMF20 1.000 0.000 NA NA 1.000
## 44 CADHDCOMF20 ~~ CADHDCOMS21 0.858 0.000 NA NA 0.858
## 45 CADHDCOMF20 ~~ KTEA_NumeracyF19 -0.138 0.000 NA NA -0.138
## 46 CADHDCOMF20 ~~ KTEA_LiteracyF19 -0.226 0.000 NA NA -0.226
## 47 CADHDCOMS21 ~~ CADHDCOMS21 1.000 0.000 NA NA 1.000
## 48 CADHDCOMS21 ~~ KTEA_NumeracyF19 -0.134 0.000 NA NA -0.134
## 49 CADHDCOMS21 ~~ KTEA_LiteracyF19 -0.229 0.000 NA NA -0.229
## 50 KTEA_NumeracyF19 ~~ KTEA_NumeracyF19 1.000 0.000 NA NA 1.000
## 51 KTEA_NumeracyF19 ~~ KTEA_LiteracyF19 0.592 0.000 NA NA 0.592
## 52 KTEA_LiteracyF19 ~~ KTEA_LiteracyF19 1.000 0.000 NA NA 1.000
## 53 GlobalAnxietyF19 ~1 0.000 0.000 NA NA 0.000
## 54 GlobalAnxietyS20 ~1 0.000 0.000 NA NA 0.000
## 55 GlobalAnxietyF20 ~1 0.000 0.000 NA NA 0.000
## 56 GlobalAnxietyS21 ~1 0.000 0.000 NA NA 0.000
## 57 CADHDCOMF19 ~1 1.122 0.000 NA NA 1.122
## 58 CADHDCOMS20 ~1 1.282 0.000 NA NA 1.282
## 59 CADHDCOMF20 ~1 1.300 0.000 NA NA 1.300
## 60 CADHDCOMS21 ~1 1.297 0.000 NA NA 1.297
## 61 KTEA_NumeracyF19 ~1 7.158 0.000 NA NA 7.158
## 62 KTEA_LiteracyF19 ~1 7.468 0.000 NA NA 7.468
## 63 Intercept ~1 -0.220 1.042 -0.211 0.833 -2.264
## 64 Linear ~1 1.665 1.823 0.913 0.361 -1.909
## ci.upper
## 1 1.039
## 2 1.037
## 3 1.214
## 4 1.040
## 5 0.000
## 6 0.327
## 7 0.765
## 8 0.955
## 9 0.561
## 10 0.683
## 11 1.063
## 12 0.483
## 13 0.424
## 14 0.208
## 15 1.369
## 16 0.526
## 17 0.176
## 18 1.864
## 19 0.170
## 20 0.711
## 21 0.496
## 22 0.406
## 23 0.581
## 24 0.762
## 25 0.409
## 26 0.473
## 27 0.269
## 28 0.482
## 29 0.980
## 30 1.106
## 31 0.717
## 32 1.000
## 33 0.770
## 34 0.818
## 35 0.764
## 36 0.032
## 37 -0.133
## 38 1.000
## 39 0.862
## 40 0.882
## 41 -0.116
## 42 -0.249
## 43 1.000
## 44 0.858
## 45 -0.138
## 46 -0.226
## 47 1.000
## 48 -0.134
## 49 -0.229
## 50 1.000
## 51 0.592
## 52 1.000
## 53 0.000
## 54 0.000
## 55 0.000
## 56 0.000
## 57 1.122
## 58 1.282
## 59 1.300
## 60 1.297
## 61 7.158
## 62 7.468
## 63 1.823
## 64 5.239
semPaths(predict4,what = "path", whatLabels = "est", edge.label.cex=.7,
intercepts = TRUE, edge.color = "black", nCharNodes = 0, nCharEdges=0,
sizeLat = 6, sizeMan=9, shapeInt = "circle")

# the mean for the intercept factor is the average anxiety score at T1, and its variance
# is the random variation around this mean initial level. The linear factor mean is the average amount
# of increase in anxiety per time point, which is assumed to be the same between all pairs of adjacent
# measurement occasion