setwd("C:/Users/user/Desktop/NTNU/longd")
dta.l <- read.csv("./dta_collapse_parent.csv")
names(dta.l)## [1] "baby_id" "baby_sex" "fa_T1" "fa_T2"
## [5] "fa_T3" "ma_T1" "ma_T2" "ma_T3"
## [9] "fatherinvo01_T1" "fatherinvo01_T2" "fatherinvo01_T3" "fatherinvo02_T1"
## [13] "fatherinvo02_T2" "fatherinvo02_T3" "fatherinvo03_T1" "fatherinvo03_T2"
## [17] "fatherinvo03_T3" "fatherinvo04_T1" "fatherinvo04_T2" "fatherinvo04_T3"
## [21] "fatherinvo05_T1" "fatherinvo05_T2" "fatherinvo05_T3" "motherinvo01_T1"
## [25] "motherinvo01_T2" "motherinvo01_T3" "motherinvo02_T1" "motherinvo02_T2"
## [29] "motherinvo02_T3" "motherinvo03_T1" "motherinvo03_T2" "motherinvo03_T3"
## [33] "motherinvo04_T1" "motherinvo04_T2" "motherinvo04_T3" "motherinvo05_T1"
## [37] "motherinvo05_T2" "motherinvo05_T3" "famedu01_T1" "famedu01_T2"
## [41] "famedu01_T3" "famedu02_T1" "famedu02_T2" "famedu02_T3"
## [45] "famedu03_T1" "famedu03_T2" "famedu03_T3" "famedu04_T1"
## [49] "famedu04_T2" "famedu04_T3" "famedu05_T1" "famedu05_T2"
## [53] "famedu05_T3" "famedu06_T1" "famedu06_T2" "famedu06_T3"
## [57] "famedu07_T1" "famedu07_T2" "famedu07_T3" "famedu08_T1"
## [61] "famedu08_T2" "famedu08_T3" "famedu09_T1" "famedu09_T2"
## [65] "famedu09_T3" "socc02_T1" "socc02_T2" "socc02_T3"
## [69] "socc03_T1" "socc03_T2" "socc03_T3" "socc09_T1"
## [73] "socc09_T2" "socc09_T3" "socc10_T1" "socc10_T2"
## [77] "socc10_T3" "chiParent_T1" "chiParent_T2" "chiParent_T3"
## [81] "disp_T1" "disp_T2" "disp_T3" "teach_T1"
## [85] "teach_T2" "teach_T3" "achExp_T1" "achExp_T2"
## [89] "achExp_T3" "shame_T1" "shame_T2" "shame_T3"
library(lavaan)## Warning: 套件 'lavaan' 是用 R 版本 4.1.3 來建造的
## This is lavaan 0.6-12
## lavaan is FREE software! Please report any bugs.
constrain factor loadings and thresholds
RICLPM1.1 <- '
################
# BETWEEN PART #
################
# Create between factors (random intercepts) for each indicator separately
RIX1 =~ 1*fatherinvo01_T1 + 1*fatherinvo01_T2 + 1*fatherinvo01_T3
RIX2 =~ 1*fatherinvo02_T1 + 1*fatherinvo02_T2 + 1*fatherinvo02_T3
RIX3 =~ 1*fatherinvo03_T1 + 1*fatherinvo03_T2 + 1*fatherinvo03_T3
RIX4 =~ 1*fatherinvo04_T1 + 1*fatherinvo04_T2 + 1*fatherinvo04_T3
RIX5 =~ 1*fatherinvo05_T1 + 1*fatherinvo05_T2 + 1*fatherinvo05_T3
RIY1 =~ 1*socc02_T1 + 1*socc02_T2 + 1*socc02_T3
RIY2 =~ 1*socc03_T1 + 1*socc03_T2 + 1*socc03_T3
RIY3 =~ 1*socc09_T1 + 1*socc09_T2 + 1*socc09_T3
RIY4 =~ 1*socc10_T1 + 1*socc10_T2 + 1*socc10_T3
##################################
# WITHIN PART: MEASUREMENT MODEL #
##################################
# Factor models for X at 3 waves
WFX1 =~ lambda1*fatherinvo01_T1 + lambda2*fatherinvo02_T1 + lambda3*fatherinvo03_T1 + lambda4*fatherinvo04_T1 + lambda5*fatherinvo05_T1
WFX2 =~ lambda1*fatherinvo01_T2 + lambda2*fatherinvo02_T2 + lambda3*fatherinvo03_T2 + lambda4*fatherinvo04_T2 + lambda5*fatherinvo05_T2
WFX3 =~ lambda1*fatherinvo01_T3 + lambda2*fatherinvo02_T3 + lambda3*fatherinvo03_T3 + lambda4*fatherinvo04_T3 + lambda5*fatherinvo05_T3
# Factor models for Y at 3 waves
# use lambda控制factor loading 在三波次相等,確保自由度
WFY1 =~ lambda6*socc02_T1 + lambda7*socc03_T1 + lambda8*socc09_T1 + lambda9*socc10_T1
WFY2 =~ lambda6*socc02_T2 + lambda7*socc03_T2 + lambda8*socc09_T2 + lambda9*socc10_T2
WFY3 =~ lambda6*socc02_T3 + lambda7*socc03_T3 + lambda8*socc09_T3 + lambda9*socc10_T3
# constrain equal threshold
socc02_T1 | a1*t1 + a2*t2 + a3*t3 + a4*t4
socc02_T2 | a1*t1 + a2*t2 + a3*t3 + a4*t4
socc02_T3 | a1*t1 + a2*t2 + a3*t3 + a4*t4
socc03_T1 | b1*t1 + b2*t2 + b3*t3 + b4*t4
socc03_T2 | b1*t1 + b2*t2 + b3*t3 + b4*t4
socc03_T3 | b1*t1 + b2*t2 + b3*t3 + b4*t4
socc09_T1 | c1*t1 + c2*t2 + c3*t3
socc09_T2 | c1*t1 + c2*t2 + c3*t3
socc09_T3 | c1*t1 + c2*t2 + c3*t3
socc10_T1 | d1*t1 + d2*t2 + d3*t3 + d4*t4
socc10_T2 | d1*t1 + d2*t2 + d3*t3 + d4*t4
socc10_T3 | d1*t1 + d2*t2 + d3*t3 + d4*t4
fatherinvo01_T1 | e1*t1 + e2*t2 + e3*t3
fatherinvo01_T2 | e1*t1 + e2*t2 + e3*t3
fatherinvo01_T3 | e1*t1 + e2*t2 + e3*t3
fatherinvo02_T1 | f1*t1 + f2*t2 + f3*t3
fatherinvo02_T2 | f1*t1 + f2*t2 + f3*t3
fatherinvo02_T3 | f1*t1 + f2*t2 + f3*t3
fatherinvo03_T1 | g1*t1 + g2*t2 + g3*t3
fatherinvo03_T2 | g1*t1 + g2*t2 + g3*t3
fatherinvo03_T3 | g1*t1 + g2*t2 + g3*t3
fatherinvo04_T1 | h1*t1 + h2*t2 + h3*t3
fatherinvo04_T2 | h1*t1 + h2*t2 + h3*t3
fatherinvo04_T3 | h1*t1 + h2*t2 + h3*t3
fatherinvo05_T1 | i1*t1 + i2*t2 + i3*t3
fatherinvo05_T2 | i1*t1 + i2*t2 + i3*t3
fatherinvo05_T3 | i1*t1 + i2*t2 + i3*t3
#########################
# WITHIN PART: DYNAMICS #
#########################
# Specify lagged effects between within-person centered latent variables
WFX2 + WFY2 ~ WFX1 + WFY1
WFX3 + WFY3 ~ WFX2 + WFY2
# Estimate correlations within same wave
WFX1 ~~ WFY1
WFX2 ~~ WFY2
WFX3 ~~ WFY3
##########################
# ADDITIONAL CONSTRAINTS #
##########################
# Constrain covariance of between factors and exogenous within factors to 0
RIX1 + RIX2 + RIX3 + RIX4 + RIX5 + RIY1 + RIY2 + RIY3 + RIY4 ~~ 0*WFY1 + 0*WFX1
'
rst.1.1 <- cfa(RICLPM1.1, data = dta.l, ordered = names(dta.l)[9:77], estimator = 'wlsmv')
summary(rst.1.1, fit.measures = T)lavaan 0.6-12 ended normally after 128 iterations
Estimator DWLS
Optimization method NLMINB
Number of model parameters 173
Number of equality constraints 74
Number of observations 1575
Model Test User Model:
Standard Robust
Test Statistic 565.185 726.786
Degrees of freedom 342 342
P-value (Chi-square) 0.000 0.000
Scaling correction factor 0.977
Shift parameter 148.461
simple second-order correction
Model Test Baseline Model:
Test statistic 255314.800 84895.576
Degrees of freedom 351 351
P-value 0.000 0.000
Scaling correction factor 3.016
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.999 0.995
Tucker-Lewis Index (TLI) 0.999 0.995
Robust Comparative Fit Index (CFI) NA
Robust Tucker-Lewis Index (TLI) NA
Root Mean Square Error of Approximation:
RMSEA 0.020 0.027
90 Percent confidence interval - lower 0.017 0.024
90 Percent confidence interval - upper 0.023 0.029
P-value RMSEA <= 0.05 1.000 1.000
Robust RMSEA NA
90 Percent confidence interval - lower NA
90 Percent confidence interval - upper NA
Standardized Root Mean Square Residual:
SRMR 0.018 0.018
Parameter Estimates:
Standard errors Robust.sem
Information Expected
Information saturated (h1) model Unstructured
Latent Variables:
Estimate Std.Err z-value P(>|z|)
RIX1 =~
ft01_T1 1.000
ft01_T2 1.000
ft01_T3 1.000
RIX2 =~
ft02_T1 1.000
ft02_T2 1.000
ft02_T3 1.000
RIX3 =~
ft03_T1 1.000
ft03_T2 1.000
ft03_T3 1.000
RIX4 =~
ft04_T1 1.000
ft04_T2 1.000
[ 達到了 getOption("max.print") -- 省略最後 54 列 ]]
Regressions:
Estimate Std.Err z-value P(>|z|)
WFX2 ~
WFX1 0.236 0.065 3.646 0.000
WFY1 -0.004 0.124 -0.036 0.971
WFY2 ~
WFX1 0.073 0.072 1.023 0.306
WFY1 0.386 0.154 2.511 0.012
WFX3 ~
WFX2 0.333 0.053 6.242 0.000
WFY2 0.040 0.064 0.622 0.534
WFY3 ~
WFX2 -0.022 0.051 -0.429 0.668
WFY2 0.519 0.064 8.052 0.000
Covariances:
Estimate Std.Err z-value P(>|z|)
WFX1 ~~
WFY1 0.035 0.022 1.632 0.103
.WFX2 ~~
.WFY2 0.022 0.018 1.246 0.213
.WFX3 ~~
.WFY3 0.033 0.013 2.548 0.011
RIX1 ~~
WFY1 0.000
WFX1 0.000
RIX2 ~~
WFY1 0.000
WFX1 0.000
RIX3 ~~
WFY1 0.000
WFX1 0.000
[ 達到了 getOption("max.print") -- 省略最後 62 列 ]]
Intercepts:
Estimate Std.Err z-value P(>|z|)
.fatherinv01_T1 0.000
.fatherinv01_T2 0.000
.fatherinv01_T3 0.000
.fatherinv02_T1 0.000
.fatherinv02_T2 0.000
.fatherinv02_T3 0.000
.fatherinv03_T1 0.000
.fatherinv03_T2 0.000
.fatherinv03_T3 0.000
.fatherinv04_T1 0.000
.fatherinv04_T2 0.000
.fatherinv04_T3 0.000
.fatherinv05_T1 0.000
.fatherinv05_T2 0.000
.fatherinv05_T3 0.000
[ 達到了 getOption("max.print") -- 省略最後 27 列 ]]
Thresholds:
Estimate Std.Err z-value P(>|z|)
sc02_T1|1 (a1) -2.240 0.054 -41.192 0.000
sc02_T1|2 (a2) -1.461 0.032 -45.788 0.000
sc02_T1|3 (a3) -0.597 0.024 -24.687 0.000
sc02_T1|4 (a4) 0.283 0.024 12.031 0.000
sc02_T2|1 (a1) -2.240 0.054 -41.192 0.000
sc02_T2|2 (a2) -1.461 0.032 -45.788 0.000
sc02_T2|3 (a3) -0.597 0.024 -24.687 0.000
sc02_T2|4 (a4) 0.283 0.024 12.031 0.000
sc02_T3|1 (a1) -2.240 0.054 -41.192 0.000
sc02_T3|2 (a2) -1.461 0.032 -45.788 0.000
sc02_T3|3 (a3) -0.597 0.024 -24.687 0.000
sc02_T3|4 (a4) 0.283 0.024 12.031 0.000
sc03_T1|1 (b1) -1.780 0.038 -47.184 0.000
sc03_T1|2 (b2) -1.001 0.025 -40.185 0.000
sc03_T1|3 (b3) 0.164 0.023 7.261 0.000
[ 達到了 getOption("max.print") -- 省略最後 75 列 ]]
Variances:
Estimate Std.Err z-value P(>|z|)
.fatherinv01_T1 0.177
.fatherinv01_T2 0.165
.fatherinv01_T3 0.167
.fatherinv02_T1 0.097
.fatherinv02_T2 0.081
.fatherinv02_T3 0.083
.fatherinv03_T1 0.132
.fatherinv03_T2 0.117
.fatherinv03_T3 0.120
.fatherinv04_T1 0.147
.fatherinv04_T2 0.131
.fatherinv04_T3 0.134
.fatherinv05_T1 0.139
.fatherinv05_T2 0.124
.fatherinv05_T3 0.127
[ 達到了 getOption("max.print") -- 省略最後 27 列 ]]
Scales y*:
Estimate Std.Err z-value P(>|z|)
fatherinv01_T1 1.000
fatherinv01_T2 1.000
fatherinv01_T3 1.000
fatherinv02_T1 1.000
fatherinv02_T2 1.000
fatherinv02_T3 1.000
fatherinv03_T1 1.000
fatherinv03_T2 1.000
fatherinv03_T3 1.000
fatherinv04_T1 1.000
fatherinv04_T2 1.000
fatherinv04_T3 1.000
fatherinv05_T1 1.000
fatherinv05_T2 1.000
fatherinv05_T3 1.000
[ 達到了 getOption("max.print") -- 省略最後 12 列 ]]
RICLPM2.2 <- '
################
# BETWEEN PART #
################
# Create between factors (random intercepts) for each indicator separately
RIX1 =~ 1*motherinvo01_T1 + 1*motherinvo01_T2 + 1*motherinvo01_T3
RIX2 =~ 1*motherinvo02_T1 + 1*motherinvo02_T2 + 1*motherinvo02_T3
RIX3 =~ 1*motherinvo03_T1 + 1*motherinvo03_T2 + 1*motherinvo03_T3
RIX4 =~ 1*motherinvo04_T1 + 1*motherinvo04_T2 + 1*motherinvo04_T3
RIX5 =~ 1*motherinvo05_T1 + 1*motherinvo05_T2 + 1*motherinvo05_T3
RIY1 =~ 1*socc02_T1 + 1*socc02_T2 + 1*socc02_T3
RIY2 =~ 1*socc03_T1 + 1*socc03_T2 + 1*socc03_T3
RIY3 =~ 1*socc09_T1 + 1*socc09_T2 + 1*socc09_T3
RIY4 =~ 1*socc10_T1 + 1*socc10_T2 + 1*socc10_T3
##################################
# WITHIN PART: MEASUREMENT MODEL #
##################################
# Factor models for X at 3 waves
WFX1 =~ lambda1*motherinvo01_T1 + lambda2*motherinvo02_T1 + lambda3*motherinvo03_T1 + lambda4*motherinvo04_T1 + lambda5*motherinvo05_T1
WFX2 =~ lambda1*motherinvo01_T2 + lambda2*motherinvo02_T2 + lambda3*motherinvo03_T2 + lambda4*motherinvo04_T2 + lambda5*motherinvo05_T2
WFX3 =~ lambda1*motherinvo01_T3 + lambda2*motherinvo02_T3 + lambda3*motherinvo03_T3 + lambda4*motherinvo04_T3 + lambda5*motherinvo05_T3
# Factor models for Y at 3 waves
WFY1 =~ lambda6*socc02_T1 + lambda7*socc03_T1 + lambda8*socc09_T1 + lambda9*socc10_T1
WFY2 =~ lambda6*socc02_T2 + lambda7*socc03_T2 + lambda8*socc09_T2 + lambda9*socc10_T2
WFY3 =~ lambda6*socc02_T3 + lambda7*socc03_T3 + lambda8*socc09_T3 + lambda9*socc10_T3
# constrain equal threshold
socc02_T1 | a1*t1 + a2*t2 + a3*t3 + a4*t4
socc02_T2 | a1*t1 + a2*t2 + a3*t3 + a4*t4
socc02_T3 | a1*t1 + a2*t2 + a3*t3 + a4*t4
socc03_T1 | b1*t1 + b2*t2 + b3*t3 + b4*t4
socc03_T2 | b1*t1 + b2*t2 + b3*t3 + b4*t4
socc03_T3 | b1*t1 + b2*t2 + b3*t3 + b4*t4
socc09_T1 | c1*t1 + c2*t2 + c3*t3
socc09_T2 | c1*t1 + c2*t2 + c3*t3
socc09_T3 | c1*t1 + c2*t2 + c3*t3
socc10_T1 | d1*t1 + d2*t2 + d3*t3 + d4*t4
socc10_T2 | d1*t1 + d2*t2 + d3*t3 + d4*t4
socc10_T3 | d1*t1 + d2*t2 + d3*t3 + d4*t4
motherinvo01_T1 | e1*t1 + e2*t2 + e3*t3
motherinvo01_T2 | e1*t1 + e2*t2 + e3*t3
motherinvo01_T3 | e1*t1 + e2*t2 + e3*t3
motherinvo02_T1 | f1*t1 + f2*t2 + f3*t3
motherinvo02_T2 | f1*t1 + f2*t2 + f3*t3
motherinvo02_T3 | f1*t1 + f2*t2 + f3*t3
motherinvo03_T1 | g1*t1 + g2*t2 + g3*t3
motherinvo03_T2 | g1*t1 + g2*t2 + g3*t3
motherinvo03_T3 | g1*t1 + g2*t2 + g3*t3
motherinvo04_T1 | h1*t1 + h2*t2 + h3*t3
motherinvo04_T2 | h1*t1 + h2*t2 + h3*t3
motherinvo04_T3 | h1*t1 + h2*t2 + h3*t3
motherinvo05_T1 | i1*t1 + i2*t2 + i3*t3
motherinvo05_T2 | i1*t1 + i2*t2 + i3*t3
motherinvo05_T3 | i1*t1 + i2*t2 + i3*t3
#########################
# WITHIN PART: DYNAMICS #
#########################
# Specify lagged effects between within-person centered latent variables
WFX2 + WFY2 ~ WFX1 + WFY1
WFX3 + WFY3 ~ WFX2 + WFY2
# Estimate correlations within same wave
WFX1 ~~ WFY1
WFX2 ~~ WFY2
WFX3 ~~ WFY3
##########################
# ADDITIONAL CONSTRAINTS #
##########################
# Constrain covariance of between factors and exogenous within factors to 0
RIX1 + RIX2 + RIX3 + RIX4 + RIX5 + RIY1 + RIY2 + RIY3 + RIY4 ~~ 0*WFY1 + 0*WFX1
'
rst.2.2 <- cfa(RICLPM2.2, data = dta.l, ordered = names(dta.l)[9:77], estimator = 'wlsmv')
summary(rst.2.2, fit.measures = T)lavaan 0.6-12 ended normally after 121 iterations
Estimator DWLS
Optimization method NLMINB
Number of model parameters 173
Number of equality constraints 74
Number of observations 1575
Model Test User Model:
Standard Robust
Test Statistic 561.106 681.525
Degrees of freedom 342 342
P-value (Chi-square) 0.000 0.000
Scaling correction factor 1.065
Shift parameter 154.874
simple second-order correction
Model Test Baseline Model:
Test statistic 220659.560 79179.169
Degrees of freedom 351 351
P-value 0.000 0.000
Scaling correction factor 2.795
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.999 0.996
Tucker-Lewis Index (TLI) 0.999 0.996
Robust Comparative Fit Index (CFI) NA
Robust Tucker-Lewis Index (TLI) NA
Root Mean Square Error of Approximation:
RMSEA 0.020 0.025
90 Percent confidence interval - lower 0.017 0.022
90 Percent confidence interval - upper 0.023 0.028
P-value RMSEA <= 0.05 1.000 1.000
Robust RMSEA NA
90 Percent confidence interval - lower NA
90 Percent confidence interval - upper NA
Standardized Root Mean Square Residual:
SRMR 0.022 0.022
Parameter Estimates:
Standard errors Robust.sem
Information Expected
Information saturated (h1) model Unstructured
Latent Variables:
Estimate Std.Err z-value P(>|z|)
RIX1 =~
mt01_T1 1.000
mt01_T2 1.000
mt01_T3 1.000
RIX2 =~
mt02_T1 1.000
mt02_T2 1.000
mt02_T3 1.000
RIX3 =~
mt03_T1 1.000
mt03_T2 1.000
mt03_T3 1.000
RIX4 =~
mt04_T1 1.000
mt04_T2 1.000
[ 達到了 getOption("max.print") -- 省略最後 54 列 ]]
Regressions:
Estimate Std.Err z-value P(>|z|)
WFX2 ~
WFX1 0.190 0.078 2.423 0.015
WFY1 0.060 0.179 0.334 0.738
WFY2 ~
WFX1 0.009 0.062 0.141 0.888
WFY1 0.359 0.161 2.235 0.025
WFX3 ~
WFX2 0.189 0.072 2.636 0.008
WFY2 0.114 0.092 1.235 0.217
WFY3 ~
WFX2 -0.027 0.051 -0.536 0.592
WFY2 0.498 0.063 7.907 0.000
Covariances:
Estimate Std.Err z-value P(>|z|)
WFX1 ~~
WFY1 0.057 0.032 1.745 0.081
.WFX2 ~~
.WFY2 0.030 0.025 1.180 0.238
.WFX3 ~~
.WFY3 0.052 0.020 2.667 0.008
RIX1 ~~
WFY1 0.000
WFX1 0.000
RIX2 ~~
WFY1 0.000
WFX1 0.000
RIX3 ~~
WFY1 0.000
WFX1 0.000
[ 達到了 getOption("max.print") -- 省略最後 62 列 ]]
Intercepts:
Estimate Std.Err z-value P(>|z|)
.motherinv01_T1 0.000
.motherinv01_T2 0.000
.motherinv01_T3 0.000
.motherinv02_T1 0.000
.motherinv02_T2 0.000
.motherinv02_T3 0.000
.motherinv03_T1 0.000
.motherinv03_T2 0.000
.motherinv03_T3 0.000
.motherinv04_T1 0.000
.motherinv04_T2 0.000
.motherinv04_T3 0.000
.motherinv05_T1 0.000
.motherinv05_T2 0.000
.motherinv05_T3 0.000
[ 達到了 getOption("max.print") -- 省略最後 27 列 ]]
Thresholds:
Estimate Std.Err z-value P(>|z|)
sc02_T1|1 (a1) -2.240 0.054 -41.192 0.000
sc02_T1|2 (a2) -1.461 0.032 -45.788 0.000
sc02_T1|3 (a3) -0.597 0.024 -24.687 0.000
sc02_T1|4 (a4) 0.283 0.024 12.031 0.000
sc02_T2|1 (a1) -2.240 0.054 -41.192 0.000
sc02_T2|2 (a2) -1.461 0.032 -45.788 0.000
sc02_T2|3 (a3) -0.597 0.024 -24.687 0.000
sc02_T2|4 (a4) 0.283 0.024 12.031 0.000
sc02_T3|1 (a1) -2.240 0.054 -41.192 0.000
sc02_T3|2 (a2) -1.461 0.032 -45.788 0.000
sc02_T3|3 (a3) -0.597 0.024 -24.687 0.000
sc02_T3|4 (a4) 0.283 0.024 12.031 0.000
sc03_T1|1 (b1) -1.780 0.038 -47.184 0.000
sc03_T1|2 (b2) -1.001 0.025 -40.185 0.000
sc03_T1|3 (b3) 0.164 0.023 7.261 0.000
[ 達到了 getOption("max.print") -- 省略最後 75 列 ]]
Variances:
Estimate Std.Err z-value P(>|z|)
.motherinv01_T1 0.076
.motherinv01_T2 0.068
.motherinv01_T3 0.095
.motherinv02_T1 0.035
.motherinv02_T2 0.026
.motherinv02_T3 0.057
.motherinv03_T1 0.046
.motherinv03_T2 0.037
.motherinv03_T3 0.069
.motherinv04_T1 0.048
.motherinv04_T2 0.038
.motherinv04_T3 0.071
.motherinv05_T1 0.103
.motherinv05_T2 0.095
.motherinv05_T3 0.122
[ 達到了 getOption("max.print") -- 省略最後 27 列 ]]
Scales y*:
Estimate Std.Err z-value P(>|z|)
motherinv01_T1 1.000
motherinv01_T2 1.000
motherinv01_T3 1.000
motherinv02_T1 1.000
motherinv02_T2 1.000
motherinv02_T3 1.000
motherinv03_T1 1.000
motherinv03_T2 1.000
motherinv03_T3 1.000
motherinv04_T1 1.000
motherinv04_T2 1.000
motherinv04_T3 1.000
motherinv05_T1 1.000
motherinv05_T2 1.000
motherinv05_T3 1.000
[ 達到了 getOption("max.print") -- 省略最後 12 列 ]]
RICLPM3.3 <- '
################
# BETWEEN PART #
################
# Create between factors (random intercepts) for each indicator separately
RIX1 =~ 1*famedu01_T1 + 1*famedu01_T2 + 1*famedu01_T3
RIX2 =~ 1*famedu02_T1 + 1*famedu02_T2 + 1*famedu02_T3
RIX3 =~ 1*famedu03_T1 + 1*famedu03_T2 + 1*famedu03_T3
RIY1 =~ 1*socc02_T1 + 1*socc02_T2 + 1*socc02_T3
RIY2 =~ 1*socc03_T1 + 1*socc03_T2 + 1*socc03_T3
RIY3 =~ 1*socc09_T1 + 1*socc09_T2 + 1*socc09_T3
RIY4 =~ 1*socc10_T1 + 1*socc10_T2 + 1*socc10_T3
##################################
# WITHIN PART: MEASUREMENT MODEL #
##################################
# Factor models for X at 3 waves
WFX1 =~ lambda1*famedu01_T1 + lambda2*famedu02_T1 + lambda3*famedu03_T1
WFX2 =~ lambda1*famedu01_T2 + lambda2*famedu02_T2 + lambda3*famedu03_T2
WFX3 =~ lambda1*famedu01_T3 + lambda2*famedu02_T3 + lambda3*famedu03_T3
# Factor models for Y at 3 waves
WFY1 =~ lambda6*socc02_T1 + lambda7*socc03_T1 + lambda8*socc09_T1 + lambda9*socc10_T1
WFY2 =~ lambda6*socc02_T2 + lambda7*socc03_T2 + lambda8*socc09_T2 + lambda9*socc10_T2
WFY3 =~ lambda6*socc02_T3 + lambda7*socc03_T3 + lambda8*socc09_T3 + lambda9*socc10_T3
# constrain equal threshold
socc02_T1 | a1*t1 + a2*t2 + a3*t3 + a4*t4
socc02_T2 | a1*t1 + a2*t2 + a3*t3 + a4*t4
socc02_T3 | a1*t1 + a2*t2 + a3*t3 + a4*t4
socc03_T1 | b1*t1 + b2*t2 + b3*t3 + b4*t4
socc03_T2 | b1*t1 + b2*t2 + b3*t3 + b4*t4
socc03_T3 | b1*t1 + b2*t2 + b3*t3 + b4*t4
socc09_T1 | c1*t1 + c2*t2 + c3*t3
socc09_T2 | c1*t1 + c2*t2 + c3*t3
socc09_T3 | c1*t1 + c2*t2 + c3*t3
socc10_T1 | d1*t1 + d2*t2 + d3*t3 + d4*t4
socc10_T2 | d1*t1 + d2*t2 + d3*t3 + d4*t4
socc10_T3 | d1*t1 + d2*t2 + d3*t3 + d4*t4
famedu01_T1 | e1*t1 + e2*t2 + e3*t3
famedu01_T2 | e1*t1 + e2*t2 + e3*t3
famedu01_T3 | e1*t1 + e2*t2 + e3*t3
famedu02_T1 | f1*t1 + f2*t2 + f3*t3
famedu02_T2 | f1*t1 + f2*t2 + f3*t3
famedu02_T3 | f1*t1 + f2*t2 + f3*t3
famedu03_T1 | g1*t1 + g2*t2 + g3*t3
famedu03_T2 | g1*t1 + g2*t2 + g3*t3
famedu03_T3 | g1*t1 + g2*t2 + g3*t3
#########################
# WITHIN PART: DYNAMICS #
#########################
# Specify lagged effects between within-person centered latent variables
WFX2 + WFY2 ~ WFX1 + WFY1
WFX3 + WFY3 ~ WFX2 + WFY2
# Estimate correlations within same wave
WFX1 ~~ WFY1
WFX2 ~~ WFY2
WFX3 ~~ WFY3
##########################
# ADDITIONAL CONSTRAINTS #
##########################
# Constrain covariance of between factors and exogenous within factors to 0
RIX1 + RIX2 + RIX3 + RIY1 + RIY2 + RIY3 + RIY4 ~~ 0*WFY1 + 0*WFX1
'
rst.3.3 <- cfa(RICLPM3.3, data = dta.l, ordered = names(dta.l)[9:77], estimator = 'wlsmv')
summary(rst.3.3, fit.measures = T)lavaan 0.6-12 ended normally after 98 iterations
Estimator DWLS
Optimization method NLMINB
Number of model parameters 132
Number of equality constraints 58
Number of observations 1575
Model Test User Model:
Standard Robust
Test Statistic 519.880 643.869
Degrees of freedom 208 208
P-value (Chi-square) 0.000 0.000
Scaling correction factor 0.870
Shift parameter 46.464
simple second-order correction
Model Test Baseline Model:
Test statistic 26186.682 14975.234
Degrees of freedom 210 210
P-value 0.000 0.000
Scaling correction factor 1.759
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.988 0.970
Tucker-Lewis Index (TLI) 0.988 0.970
Robust Comparative Fit Index (CFI) NA
Robust Tucker-Lewis Index (TLI) NA
Root Mean Square Error of Approximation:
RMSEA 0.031 0.036
90 Percent confidence interval - lower 0.028 0.033
90 Percent confidence interval - upper 0.034 0.040
P-value RMSEA <= 0.05 1.000 1.000
Robust RMSEA NA
90 Percent confidence interval - lower NA
90 Percent confidence interval - upper NA
Standardized Root Mean Square Residual:
SRMR 0.021 0.021
Parameter Estimates:
Standard errors Robust.sem
Information Expected
Information saturated (h1) model Unstructured
Latent Variables:
Estimate Std.Err z-value P(>|z|)
RIX1 =~
fm01_T1 1.000
fm01_T2 1.000
fm01_T3 1.000
RIX2 =~
fm02_T1 1.000
fm02_T2 1.000
fm02_T3 1.000
RIX3 =~
fm03_T1 1.000
fm03_T2 1.000
fm03_T3 1.000
RIY1 =~
sc02_T1 1.000
sc02_T2 1.000
[ 達到了 getOption("max.print") -- 省略最後 40 列 ]]
Regressions:
Estimate Std.Err z-value P(>|z|)
WFX2 ~
WFX1 -0.016 0.140 -0.115 0.908
WFY1 -0.075 0.156 -0.483 0.629
WFY2 ~
WFX1 -0.272 0.123 -2.204 0.027
WFY1 0.423 0.148 2.866 0.004
WFX3 ~
WFX2 0.315 0.061 5.140 0.000
WFY2 -0.069 0.069 -0.996 0.319
WFY3 ~
WFX2 -0.074 0.058 -1.286 0.199
WFY2 0.501 0.063 7.955 0.000
Covariances:
Estimate Std.Err z-value P(>|z|)
WFX1 ~~
WFY1 0.023 0.022 1.044 0.297
.WFX2 ~~
.WFY2 -0.013 0.021 -0.588 0.556
.WFX3 ~~
.WFY3 0.018 0.014 1.242 0.214
RIX1 ~~
WFY1 0.000
WFX1 0.000
RIX2 ~~
WFY1 0.000
WFX1 0.000
RIX3 ~~
WFY1 0.000
WFX1 0.000
[ 達到了 getOption("max.print") -- 省略最後 39 列 ]]
Intercepts:
Estimate Std.Err z-value P(>|z|)
.famedu01_T1 0.000
.famedu01_T2 0.000
.famedu01_T3 0.000
.famedu02_T1 0.000
.famedu02_T2 0.000
.famedu02_T3 0.000
.famedu03_T1 0.000
.famedu03_T2 0.000
.famedu03_T3 0.000
.socc02_T1 0.000
.socc02_T2 0.000
.socc02_T3 0.000
.socc03_T1 0.000
.socc03_T2 0.000
.socc03_T3 0.000
[ 達到了 getOption("max.print") -- 省略最後 19 列 ]]
Thresholds:
Estimate Std.Err z-value P(>|z|)
sc02_T1|1 (a1) -2.240 0.054 -41.192 0.000
sc02_T1|2 (a2) -1.461 0.032 -45.788 0.000
sc02_T1|3 (a3) -0.597 0.024 -24.687 0.000
sc02_T1|4 (a4) 0.283 0.024 12.031 0.000
sc02_T2|1 (a1) -2.240 0.054 -41.192 0.000
sc02_T2|2 (a2) -1.461 0.032 -45.788 0.000
sc02_T2|3 (a3) -0.597 0.024 -24.687 0.000
sc02_T2|4 (a4) 0.283 0.024 12.031 0.000
sc02_T3|1 (a1) -2.240 0.054 -41.192 0.000
sc02_T3|2 (a2) -1.461 0.032 -45.788 0.000
sc02_T3|3 (a3) -0.597 0.024 -24.687 0.000
sc02_T3|4 (a4) 0.283 0.024 12.031 0.000
sc03_T1|1 (b1) -1.780 0.038 -47.184 0.000
sc03_T1|2 (b2) -1.001 0.025 -40.185 0.000
sc03_T1|3 (b3) 0.164 0.023 7.261 0.000
[ 達到了 getOption("max.print") -- 省略最後 57 列 ]]
Variances:
Estimate Std.Err z-value P(>|z|)
.famedu01_T1 0.364
.famedu01_T2 0.261
.famedu01_T3 0.238
.famedu02_T1 0.302
.famedu02_T2 0.176
.famedu02_T3 0.149
.famedu03_T1 0.491
.famedu03_T2 0.434
.famedu03_T3 0.421
.socc02_T1 0.508
.socc02_T2 0.371
.socc02_T3 0.410
.socc03_T1 0.636
.socc03_T2 0.548
.socc03_T3 0.573
[ 達到了 getOption("max.print") -- 省略最後 19 列 ]]
Scales y*:
Estimate Std.Err z-value P(>|z|)
famedu01_T1 1.000
famedu01_T2 1.000
famedu01_T3 1.000
famedu02_T1 1.000
famedu02_T2 1.000
famedu02_T3 1.000
famedu03_T1 1.000
famedu03_T2 1.000
famedu03_T3 1.000
socc02_T1 1.000
socc02_T2 1.000
socc02_T3 1.000
socc03_T1 1.000
socc03_T2 1.000
socc03_T3 1.000
[ 達到了 getOption("max.print") -- 省略最後 6 列 ]]