See this link: http://lavaan.ugent.be/tutorial/growth.html
### Model
# Education Models
LG.mod.ed <- '
int=~1*ALAQSUM+1*CLAQSUM+1*DLAQSUM
slope=~0*ALAQSUM+1*CLAQSUM+2*DLAQSUM
#intercept~AAUDITTot.log
#slope~AAUDITTot.log
ED.binary~int+slope
'
fit.ed <- growth(LG.mod.ed, data=A1.tm, missing="ml")
sum1 <- summary(fit.ed, fit.measures=TRUE, standardized=TRUE)
## lavaan (0.5-22) converged normally after 341 iterations
##
## Used Total
## Number of observations 1152 1169
##
## Number of missing patterns 6
##
## Estimator ML
## Minimum Function Test Statistic 0.120
## Degrees of freedom 3
## P-value (Chi-square) 0.989
##
## Model test baseline model:
##
## Minimum Function Test Statistic 876.132
## Degrees of freedom 6
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.007
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -10478.902
## Loglikelihood unrestricted model (H1) -10478.842
##
## Number of free parameters 11
## Akaike (AIC) 20979.803
## Bayesian (BIC) 21035.345
## Sample-size adjusted Bayesian (BIC) 21000.405
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent Confidence Interval 0.000 0.000
## P-value RMSEA <= 0.05 1.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.003
##
## Parameter Estimates:
##
## Information Observed
## Standard Errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## int =~
## ALAQSUM 1.000 8.163 0.927
## CLAQSUM 1.000 8.163 0.817
## DLAQSUM 1.000 8.163 0.921
## slope =~
## ALAQSUM 0.000 0.000 0.000
## CLAQSUM 1.000 3.571 0.357
## DLAQSUM 2.000 7.141 0.806
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ED.binary ~
## int 0.016 0.000 51.756 0.000 0.135 0.360
## slope 0.045 0.006 7.188 0.000 0.160 0.427
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## int ~~
## slope -13.868 2.675 -5.185 0.000 -0.476 -0.476
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .ALAQSUM 0.000 0.000 0.000
## .CLAQSUM 0.000 0.000 0.000
## .DLAQSUM 0.000 0.000 0.000
## .ED.binary 0.000 0.000 0.000
## int 55.823 0.259 215.756 0.000 6.838 6.838
## slope -1.984 0.146 -13.605 0.000 -0.556 -0.556
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .ALAQSUM 10.896 4.399 2.477 0.013 10.896 0.141
## .CLAQSUM 48.195 2.931 16.446 0.000 48.195 0.483
## .DLAQSUM 16.356 4.149 3.942 0.000 16.356 0.208
## .ED.binary 0.116 0.006 18.402 0.000 0.116 0.834
## int 66.637 5.191 12.837 0.000 1.000 1.000
## slope 12.749 2.102 6.066 0.000 1.000 1.000
LG.mod.ed.ss <- '
int=~1*ALAQSUM+1*CLAQSUM+1*DLAQSUM
slope=~0*ALAQSUM+1*CLAQSUM+2*DLAQSUM
#int~AAUDITTot.log
#slope~AAUDITTot.log
'
fit.ed.ss <- growth(LG.mod.ed.ss, data=A1.tm, missing="ml",group="ED.binary")
summary(fit.ed.ss, fit.measures=TRUE, standardized=TRUE)
## lavaan (0.5-22) converged normally after 192 iterations
##
## Number of observations per group
## 1 702
## 0 141
##
## Number of missing patterns per group
## 1 4
## 0 2
##
## Estimator ML
## Minimum Function Test Statistic 0.301
## Degrees of freedom 2
## P-value (Chi-square) 0.860
##
## Chi-square for each group:
##
## 1 0.021
## 0 0.280
##
## Model test baseline model:
##
## Minimum Function Test Statistic 684.460
## Degrees of freedom 6
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.008
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -8569.230
## Loglikelihood unrestricted model (H1) -8569.079
##
## Number of free parameters 16
## Akaike (AIC) 17170.459
## Bayesian (BIC) 17246.251
## Sample-size adjusted Bayesian (BIC) 17195.440
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent Confidence Interval 0.000 0.051
## P-value RMSEA <= 0.05 0.947
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.003
##
## Parameter Estimates:
##
## Information Observed
## Standard Errors Standard
##
##
## Group 1 [1]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## int =~
## ALAQSUM 1.000 7.989 0.929
## CLAQSUM 1.000 7.989 0.848
## DLAQSUM 1.000 7.989 0.957
## slope =~
## ALAQSUM 0.000 0.000 0.000
## CLAQSUM 1.000 3.356 0.356
## DLAQSUM 2.000 6.711 0.804
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## int ~~
## slope -14.579 2.886 -5.052 0.000 -0.544 -0.544
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .ALAQSUM 0.000 0.000 0.000
## .CLAQSUM 0.000 0.000 0.000
## .DLAQSUM 0.000 0.000 0.000
## int 56.496 0.323 174.694 0.000 7.072 7.072
## slope -1.612 0.163 -9.909 0.000 -0.480 -0.480
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .ALAQSUM 10.084 4.740 2.127 0.033 10.084 0.136
## .CLAQSUM 42.738 3.054 13.994 0.000 42.738 0.482
## .DLAQSUM 19.135 4.620 4.142 0.000 19.135 0.275
## int 63.822 5.812 10.980 0.000 1.000 1.000
## slope 11.260 2.249 5.006 0.000 1.000 1.000
##
##
## Group 2 [0]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## int =~
## ALAQSUM 1.000 8.089 0.888
## CLAQSUM 1.000 8.089 0.801
## DLAQSUM 1.000 8.089 1.031
## slope =~
## ALAQSUM 0.000 0.000 0.000
## CLAQSUM 1.000 3.255 0.323
## DLAQSUM 2.000 6.510 0.830
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## int ~~
## slope -15.493 7.403 -2.093 0.036 -0.588 -0.588
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .ALAQSUM 0.000 0.000 0.000
## .CLAQSUM 0.000 0.000 0.000
## .DLAQSUM 0.000 0.000 0.000
## int 53.138 0.763 69.615 0.000 6.569 6.569
## slope -4.034 0.367 -11.001 0.000 -1.239 -1.239
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .ALAQSUM 17.611 13.125 1.342 0.180 17.611 0.212
## .CLAQSUM 56.827 8.771 6.479 0.000 56.827 0.558
## .DLAQSUM 15.708 11.199 1.403 0.161 15.708 0.255
## int 65.440 15.117 4.329 0.000 1.000 1.000
## slope 10.597 5.687 1.863 0.062 1.000 1.000
# Treatment Models
LG.mod.tx <- '
int=~1*ALAQSUM+1*CLAQSUM+1*DLAQSUM
slope=~0*ALAQSUM+1*CLAQSUM+2*DLAQSUM
#intercept~AAUDITTot.log
#slope~AAUDITTot.log
rndcode.binary~int+slope
'
fit.tx <- growth(LG.mod.tx, data=A1.tm, missing="ml")
summary(fit.tx, fit.measures=TRUE, standardized=TRUE,modindices=TRUE)
## lavaan (0.5-22) converged normally after 196 iterations
##
## Number of observations 1169
##
## Number of missing patterns 5
##
## Estimator ML
## Minimum Function Test Statistic 0.821
## Degrees of freedom 3
## P-value (Chi-square) 0.845
##
## Model test baseline model:
##
## Minimum Function Test Statistic 770.499
## Degrees of freedom 6
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.006
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -10930.684
## Loglikelihood unrestricted model (H1) -10930.274
##
## Number of free parameters 11
## Akaike (AIC) 21883.368
## Bayesian (BIC) 21939.071
## Sample-size adjusted Bayesian (BIC) 21904.131
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent Confidence Interval 0.000 0.028
## P-value RMSEA <= 0.05 0.996
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.008
##
## Parameter Estimates:
##
## Information Observed
## Standard Errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## int =~
## ALAQSUM 1.000 8.121 0.922
## CLAQSUM 1.000 8.121 0.815
## DLAQSUM 1.000 8.121 0.915
## slope =~
## ALAQSUM 0.000 0.000 0.000
## CLAQSUM 1.000 3.518 0.353
## DLAQSUM 2.000 7.036 0.793
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## rndcode.binary ~
## int 0.006 0.000 17.633 0.000 0.046 0.100
## slope 0.002 0.006 0.345 0.730 0.007 0.015
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## int ~~
## slope -13.471 2.687 -5.014 0.000 -0.472 -0.472
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .ALAQSUM 0.000 0.000 0.000
## .CLAQSUM 0.000 0.000 0.000
## .DLAQSUM 0.000 0.000 0.000
## .rndcode.binary 0.000 0.000 0.000
## int 55.817 0.259 215.796 0.000 6.874 6.874
## slope -1.988 0.146 -13.624 0.000 -0.565 -0.565
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .ALAQSUM 11.602 4.412 2.630 0.009 11.602 0.150
## .CLAQSUM 47.848 2.947 16.235 0.000 47.848 0.482
## .DLAQSUM 17.155 4.623 3.711 0.000 17.155 0.218
## .rndcode.binary 0.215 0.009 24.146 0.000 0.215 0.991
## int 65.943 5.177 12.737 0.000 1.000 1.000
## slope 12.376 2.183 5.669 0.000 1.000 1.000
##
## Modification Indices:
##
## lhs op rhs mi epc sepc.lv sepc.all
## 1 int =~ ALAQSUM 0.028 -0.001 -0.012 -0.001
## 2 int =~ CLAQSUM 0.045 0.001 0.008 0.001
## 3 int =~ DLAQSUM 0.032 -0.002 -0.013 -0.001
## 4 slope =~ ALAQSUM 0.025 0.039 0.138 0.016
## 5 slope =~ CLAQSUM 0.064 -0.032 -0.111 -0.011
## 6 slope =~ DLAQSUM 0.056 0.059 0.208 0.023
## 16 ALAQSUM ~1 0.025 -0.079 -0.079 -0.009
## 17 CLAQSUM ~1 0.039 0.049 0.049 0.005
## 18 DLAQSUM ~1 0.027 -0.081 -0.081 -0.009
## 19 rndcode.binary ~1 544.289 0.317 0.317 0.679
## 22 int =~ rndcode.binary 549.401 0.006 0.046 0.098
## 23 slope =~ rndcode.binary 237.081 -0.065 -0.229 -0.491
## 24 ALAQSUM ~~ CLAQSUM 0.657 16.542 16.542 0.189
## 25 ALAQSUM ~~ DLAQSUM 1.313 -43.392 -43.392 -0.555
## 26 ALAQSUM ~~ rndcode.binary 2.075 0.141 0.141 0.034
## 27 CLAQSUM ~~ DLAQSUM 1.184 142.794 142.794 1.616
## 28 CLAQSUM ~~ rndcode.binary 0.782 0.101 0.101 0.022
## 29 DLAQSUM ~~ rndcode.binary 0.037 -0.022 -0.022 -0.005
## 30 int ~ rndcode.binary 4.976 1.110 0.137 0.064
## 31 int ~ slope 9.830 -22.114 -9.580 -9.580
## 32 slope ~ rndcode.binary 0.070 0.074 0.021 0.010
## 33 slope ~ int 2.970 0.423 0.977 0.977
## sepc.nox
## 1 -0.001
## 2 0.001
## 3 -0.001
## 4 0.016
## 5 -0.011
## 6 0.023
## 16 -0.009
## 17 0.005
## 18 -0.009
## 19 0.679
## 22 0.098
## 23 -0.491
## 24 0.189
## 25 -0.555
## 26 0.034
## 27 1.616
## 28 0.022
## 29 -0.005
## 30 0.064
## 31 -9.580
## 32 0.010
## 33 0.977
a <- parTable(fit.tx)[c(7:8,20:21),c("est","se")]
write.excel(a)
LG.mod.tx.ss <- '
int=~1*ALAQSUM+1*CLAQSUM+1*DLAQSUM
slope=~0*ALAQSUM+1*CLAQSUM+2*DLAQSUM
#intercept~AAUDITTot.log
#slope~AAUDITTot.log
'
fit.tx.ss <- growth(LG.mod.tx.ss, data=A1.tm, missing="ml",group="rndcode.binary")
summary(fit.tx.ss, fit.measures=TRUE, standardized=TRUE)
## lavaan (0.5-22) converged normally after 196 iterations
##
## Number of observations per group
## 1 370
## 0 782
##
## Number of missing patterns per group
## 1 4
## 0 4
##
## Estimator ML
## Minimum Function Test Statistic 0.291
## Degrees of freedom 2
## P-value (Chi-square) 0.865
##
## Chi-square for each group:
##
## 1 0.263
## 0 0.028
##
## Model test baseline model:
##
## Minimum Function Test Statistic 764.818
## Degrees of freedom 6
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.007
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -10164.497
## Loglikelihood unrestricted model (H1) -10164.352
##
## Number of free parameters 16
## Akaike (AIC) 20360.995
## Bayesian (BIC) 20441.783
## Sample-size adjusted Bayesian (BIC) 20390.962
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent Confidence Interval 0.000 0.043
## P-value RMSEA <= 0.05 0.965
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.003
##
## Parameter Estimates:
##
## Information Observed
## Standard Errors Standard
##
##
## Group 1 [1]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## int =~
## ALAQSUM 1.000 7.727 0.895
## CLAQSUM 1.000 7.727 0.801
## DLAQSUM 1.000 7.727 0.918
## slope =~
## ALAQSUM 0.000 0.000 0.000
## CLAQSUM 1.000 2.932 0.304
## DLAQSUM 2.000 5.865 0.696
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## int ~~
## slope -11.656 4.617 -2.524 0.012 -0.514 -0.514
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .ALAQSUM 0.000 0.000 0.000
## .CLAQSUM 0.000 0.000 0.000
## .DLAQSUM 0.000 0.000 0.000
## int 56.704 0.447 126.902 0.000 7.339 7.339
## slope -2.163 0.245 -8.822 0.000 -0.737 -0.737
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .ALAQSUM 14.899 7.615 1.956 0.050 14.899 0.200
## .CLAQSUM 48.027 5.114 9.391 0.000 48.027 0.516
## .DLAQSUM 23.436 8.169 2.869 0.004 23.436 0.330
## int 59.703 8.721 6.846 0.000 1.000 1.000
## slope 8.599 3.817 2.253 0.024 1.000 1.000
##
##
## Group 2 [0]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## int =~
## ALAQSUM 1.000 8.299 0.937
## CLAQSUM 1.000 8.299 0.821
## DLAQSUM 1.000 8.299 0.915
## slope =~
## ALAQSUM 0.000 0.000 0.000
## CLAQSUM 1.000 3.777 0.373
## DLAQSUM 2.000 7.555 0.833
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## int ~~
## slope -14.425 3.315 -4.351 0.000 -0.460 -0.460
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .ALAQSUM 0.000 0.000 0.000
## .CLAQSUM 0.000 0.000 0.000
## .DLAQSUM 0.000 0.000 0.000
## int 55.410 0.316 175.331 0.000 6.676 6.676
## slope -1.904 0.181 -10.519 0.000 -0.504 -0.504
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .ALAQSUM 9.543 5.448 1.752 0.080 9.543 0.122
## .CLAQSUM 47.984 3.634 13.205 0.000 47.984 0.469
## .DLAQSUM 14.094 5.659 2.491 0.013 14.094 0.171
## int 68.879 6.448 10.682 0.000 1.000 1.000
## slope 14.268 2.687 5.310 0.000 1.000 1.000
## est se
## 20 55.823 0.259
## 21 -1.984 0.146