Dear all,
I am learning to run a univariate latent change score model with multiple indicator variables. I have read some articles about running it with R (lavaan), and I have tried to run it by using sem builder in STATA. However, I am not sure whether it is analyzing the same model represented by the R codes as I do not have any knowledge about R. Especially, while the R codes include a constant "1" pointing to COG and COG_T1, I wonder how it can be included in the sem model in STATA. Besides, I am not sure how the means of the latent variables can be estimated in the sem model. May anyone help to explain it? Thank you so much!
Here are the sem model that I have created, the STATA codes thus generated and the results:

Below are the latent change score model, the corresponding R codes and results:

I am learning to run a univariate latent change score model with multiple indicator variables. I have read some articles about running it with R (lavaan), and I have tried to run it by using sem builder in STATA. However, I am not sure whether it is analyzing the same model represented by the R codes as I do not have any knowledge about R. Especially, while the R codes include a constant "1" pointing to COG and COG_T1, I wonder how it can be included in the sem model in STATA. Besides, I am not sure how the means of the latent variables can be estimated in the sem model. May anyone help to explain it? Thank you so much!
Here are the sem model that I have created, the STATA codes thus generated and the results:
PHP Code:
sem (COG_T1@1 -> t1x1, ) (COG_T1@a -> t1x2, ) (COG_T1@b -> t1x3, ) (COG_T1@1 -> COG_T2, ) (COG_T1 -> COG, ) (COG_T2@1 -> t2x1, ) (COG_T2@a ->
> t2x2, ) (COG_T2@b -> t2x3, ) (COG@1 -> COG_T2, ), latent(COG_T1 COG_T2 COG ) cov( e.t1x1@c e.t1x1*e.t2x1 e.t1x2@d e.t1x2*e.t2x2 e.t1x3@e e.t1x
> 3*e.t2x3 e.COG_T2@0 e.t2x1@c e.t2x2@d e.t2x3@e) nocapslatent
PHP Code:
-----------------------------------------------------------------------------------
| OIM
| Coefficient std. err. z P>|z| [95% conf. interval]
------------------+----------------------------------------------------------------
Structural |
COG_T2 |
COG | 1 (constrained)
COG_T1 | 1 (constrained)
----------------+----------------------------------------------------------------
COG |
COG_T1 | -.0062352 .0407409 -0.15 0.878 -.0860858 .0736154
------------------+----------------------------------------------------------------
Measurement |
t1x1 |
COG_T1 | 1 (constrained)
_cons | 39.94355 .1090095 366.42 0.000 39.72989 40.1572
----------------+----------------------------------------------------------------
t1x2 |
COG_T1 | 1.116257 .0199764 55.88 0.000 1.077104 1.15541
_cons | 45.9573 .121152 379.34 0.000 45.71984 46.19475
----------------+----------------------------------------------------------------
t1x3 |
COG_T1 | .8701127 .0171555 50.72 0.000 .8364885 .9037368
_cons | 35.40391 .098166 360.65 0.000 35.21151 35.59631
----------------+----------------------------------------------------------------
t2x1 |
COG_T2 | 1 (constrained)
_cons | 44.05405 .1348517 326.69 0.000 43.78974 44.31835
----------------+----------------------------------------------------------------
t2x2 |
COG_T2 | 1.116257 .0199764 55.88 0.000 1.077104 1.15541
_cons | 50.55733 .1501005 336.82 0.000 50.26314 50.85152
----------------+----------------------------------------------------------------
t2x3 |
COG_T2 | .8701127 .0171555 50.72 0.000 .8364885 .9037368
_cons | 39.0069 .1200321 324.97 0.000 38.77164 39.24216
------------------+----------------------------------------------------------------
var(e.t1x1)| .9073758 .0657532 .7872355 1.045851
var(e.t1x2)| 1.06619 .0802102 .9200222 1.235581
var(e.t1x3)| 1.006938 .0605295 .8950244 1.132845
var(e.t2x1)| .9073758 .0657532 .7872355 1.045851
var(e.t2x2)| 1.06619 .0802102 .9200222 1.235581
var(e.t2x3)| 1.006938 .0605295 .8950244 1.132845
var(e.COG_T2)| 0 (constrained)
var(e.COG)| 3.213538 .2546385 2.75128 3.753462
var(COG_T1)| 5.034157 .3566719 4.38146 5.784085
------------------+----------------------------------------------------------------
cov(e.t1x1,e.t2x1)| .0554387 .0636501 0.87 0.384 -.0693131 .1801906
cov(e.t1x2,e.t2x2)| .02881 .0774649 0.37 0.710 -.1230184 .1806384
cov(e.t1x3,e.t2x3)| .0305753 .059449 0.51 0.607 -.0859426 .1470932
-----------------------------------------------------------------------------------
LR test of model vs. saturated: chi2(10) = 18.70 Prob > chi2 = 0.0442
. estat gof, stats(all)
----------------------------------------------------------------------------
Fit statistic | Value Description
---------------------+------------------------------------------------------
Likelihood ratio |
chi2_ms(10) | 18.702 model vs. saturated
p > chi2 | 0.044
chi2_bs(15) | 3403.806 baseline vs. saturated
p > chi2 | 0.000
---------------------+------------------------------------------------------
Population error |
RMSEA | 0.042 Root mean squared error of approximation
90% CI, lower bound | 0.007
upper bound | 0.071
pclose | 0.641 Probability RMSEA <= 0.05
---------------------+------------------------------------------------------
Information criteria |
AIC | 11136.772 Akaike's information criterion
BIC | 11208.420 Bayesian information criterion
---------------------+------------------------------------------------------
Baseline comparison |
CFI | 0.997 Comparative fit index
TLI | 0.996 Tucker–Lewis index
---------------------+------------------------------------------------------
Size of residuals |
SRMR | 0.024 Standardized root mean squared residual
CD | 0.967 Coefficient of determination
----------------------------------------------------------------------------
Below are the latent change score model, the corresponding R codes and results:
PHP Code:
#
library(lavaan);
modelData <- read.table(DATAFILENAME, header = TRUE) ;
model<-"
! regressions
COG_T2=~gamma2*T2X2
COG_T2=~gamma3*T2X3
COG_T2=~1.0*T2X1
COG_T1=~1.0*T1X1
COG_T1=~gamma2*T1X2
COG_T1=~gamma3*T1X3
COG=~1.0*COG_T2
COG_T1=~beta*COG
COG_T1=~1.0*COG_T2
! residuals, variances and covariances
COG ~~ VAR___COG*COG
T1X1 ~~ VAR_X1*T1X1
T1X2 ~~ VAR_X2*T1X2
T1X3 ~~ VAR_X3*T1X3
T2X1 ~~ VAR_X1*T2X1
T2X2 ~~ VAR_X2*T2X2
T2X3 ~~ VAR_X3*T2X3
T1X1 ~~ COVX1*T2X1
T1X2 ~~ COVX2*T2X2
T1X3 ~~ COVX3*T2X3
COG_T1 ~~ VAR_COG_T1*COG_T1
COG_T2~~0*COG_T2;
! means
COG~mu____COG_*1
COG_T1~mean_COG_T1*1
T1X1~1.0*1;
T2X1~1.0*1;
T1X2~const__X2*1
T1X3~const__X3*1
T2X2~const__X2*1
T2X3~const__X3*1
COG_T2~0*1;
";
result<-lavaan(model, data=modelData, fixed.x=FALSE, missing="FIML");
summary(result, fit.measures=TRUE);
PHP Code:
T1X1 T1X2 T1X3 T2X1
Min. :33.37159 Min. :37.49925 Min. :29.71602 Min. :34.95444
1st Qu.:38.12540 1st Qu.:44.26538 1st Qu.:33.96661 1st Qu.:41.99031
Median :39.97928 Median :45.90049 Median :35.38929 Median :44.16869
Mean :39.94355 Mean :45.95730 Mean :35.40391 Mean :44.05405
3rd Qu.:41.56168 3rd Qu.:47.63180 3rd Qu.:36.97583 3rd Qu.:46.09717
Max. :49.53954 Max. :55.34033 Max. :43.21093 Max. :51.98614
Stdv :2.50592 Stdv :2.67662 Stdv :2.16593 Stdv :2.96251
Total :500 Total :500 Total :500 Total :500
Missing:0 Missing:0 Missing:0 Missing:0
T2X2 T2X3
Min. :39.68124 Min. :30.97837
1st Qu.:48.28159 1st Qu.:37.23325
Median :50.71180 Median :39.08314
Mean :50.55733 Mean :39.00690
3rd Qu.:52.84079 3rd Qu.:40.74571
Max. :60.30775 Max. :48.08366
Stdv :3.38781 Stdv :2.71277
Total :500 Total :500
Missing:0 Missing:0
#| name| From / To|Estimate|Std.Error|lbound|rbound
--+------------+------------------------+--------+---------+------+------
0| VAR_?�COG| ?�COG <-> ?�COG| 3.20496| 0.24995| |
1|$\mu_{?�COG}| mean ?�COG| 4.35351| 1.58954| |
2| VAR_X1| T1X1 <-> T1X1 (+other)| 0.90928| 0.06467| |
3| VAR_X2| T1X2 <-> T1X2 (+other)| 1.06628| 0.07878| |
4| VAR_X3| T1X3 <-> T1X3 (+other)| 1.00527| 0.06005| |
5| \gamma2|COG_T1 --> T1X2 (+other)| 1.11753| 0.01489| |
6| \gamma3|COG_T1 --> T1X3 (+other)| 0.87290| 0.01292| |
7| COVX1| T2X1 <-> T1X1| 0.05575| 0.06355| |
8| COVX2| T2X2 <-> T1X2| 0.02865| 0.07731| |
9| COVX3| T2X3 <-> T1X3| 0.03000| 0.05941| |
10| VAR_COG_T1| COG_T1 <-> COG_T1| 5.02092| 0.34845| |
11| mean_COG_T1| mean COG_T1|38.94034| 0.10752| |
12| beta| COG_T1 --> ?�COG|-0.00608| 0.04073| |
13| const->X2| mean T1X2 (+other)| 2.43977| 0.61247| |
14| const->X3| mean T1X3 (+other)| 1.41759| 0.53139| |
Observed Statistics : 27
Estimated Parameters : 15
Non-Missing Ratio : 1.0
Number of Observations : 500
Minus Two Log Likelihood : 11102.833
Log Likelihood : -5551.416
Independent -2LL : 14487.876
Saturated -2LL : 11084.07
χ² : 18.763
Restricted Degrees of Freedom : 12
AIC : 11132.833
AICc : 11132.833
BIC : 11196.052
BIC (sample-size adjusted) : 11199.048
Kulback-Leibler to Saturated : 0.038
χ² from independent : 3403.806
Degrees of Freedom (indep.) :15
RMSEA (df corrected) : 0.034
RMSEA (Kulback Leibler) : 0.034
RMSEA (classic) : 0.034
SRMR (covariances only) : 0.008
CFI (to independent model) : 0.998
TLI (to independent model) : 0.998
Timestamp : 12.3.2025, 10:37:36
Runner Individual Time : 0.055760399999999995
Wall Clock Time : 91.1529092
Runner Time at convergence : 0.0487475
Wall Clock at convergence : 0.1343385
This estimate is the best found.
This estimate is still improving.
There are 7 local maxium likelihood optima found so far, 0 of them reliable.
This estimate has been found with 0 starting value sets converged in total.