# ══════════════════════════════════════════════════════
# 유아교육연구의 양적접근 | 2026-1학기
# 9주차: 측정모형 (CFA) 실습 (R lavaan)
# 강사: 서울대학교 의학연구원 김주현
# 모형: 사회적지지(SS) / 우울감(MDEP) / 사회적 양육행동(PAR)
#       → 다지표 확인적 요인분석 (CFA) 및 결과 해석
# ══════════════════════════════════════════════════════


# ────────────────────────────────────────────────────────────
# STEP 0. 데이터 불러오기                                        
# ────────────────────────────────────────────────────────────
data <- read.delim("C:/Users/Lenovo/Desktop/path_analysis/w2.dat", row.names=1)
data[data == 99999999] <- NA

# ══════════════════════════════════════════════════════
# STEP 0.패키지 설치 및 로드
# ══════════════════════════════════════════════════════

# 설치 (처음 한 번만)
#install.packages("lavaan")
#install.packages("semPlot")

# 로드 (매번 실행 시)
library(lavaan)
## This is lavaan 0.6-21
## lavaan is FREE software! Please report any bugs.
library(semPlot)

# ══════════════════════════════════════════════════════
# STEP 1. 
# 측정모형 설정: 각 잠재변수와 지표변수 정의

# 잠재변수 1: 사회적 지지 (SS)
# SS =~ SS_EMO + SS_INS + SS_INF + SS_SOC

# 잠재변수 2: 우울감 (MDEP)
# MDEP =~ EMt09dpr013 + EMt09dpr014 + EMt09dpr015 +
#          EMt09dpr016 + EMt09dpr017 + EMt09dpr018

# 잠재변수 3: 사회적 양육행동 (PAR)
# PAR =~ EMt09crs001 + EMt09crs002 + EMt09crs003 +
#         EMt09crs004 + EMt09crs005 + EMt09crs006
# ══════════════════════════════════════════════════════

model_cfa <- '
  SS   =~ SS_EMO + SS_INS + SS_INF + SS_SOC
  DEP =~ EMt09dpr013 + EMt09dpr014 + EMt09dpr015 +
           EMt09dpr016 + EMt09dpr017 + EMt09dpr018
  PAR  =~ EMt09crs001 + EMt09crs002 + EMt09crs003 +
           EMt09crs004 + EMt09crs005 + EMt09crs006
'
fit_cfa <- cfa(model_cfa, data = data,
               estimator = "ML",
               missing = "fiml",
               fixed.x = FALSE)
## Warning: lavaan->lav_data_full():  
##    some cases are empty and will be ignored: 16 17 18 21 28 47 56 64 67 81 99 
##    105 108 110 113 125 127 129 136 137 161 166 173 175 182 198 204 224 225 
##    227 235 252 261 262 266 282 294 298 303 311 319 320 324 330 337 345 348 
##    349 353 361 366 370 379 388 389 392 405 419 423 439 445 467 468 480 486 
##    489 495 503 521 535 547 551 559 583 587 590 610 612 630 632 634 653 671 
##    674 676 693 699 700 710 721 722 731 747 756 763 765 771 772 780 781 782 
##    787 790 793 829 836 840 851 853 864 869 882 886 892 893 897 898 902 914 
##    916 919 922 924 928 930 931 937 939 941 948 952 973 976 978 979 1054 1081 
##    1123 1128 1146 1151 1162 1173 1182 1192 1241 1282 1299 1301 1306 1307 1310 
##    1316 1329 1338 1350 1358 1360 1363 1375 1378 1390 1394 1402 1407 1409 1414 
##    1418 1422 1433 1435 1440 1444 1451 1454 1467 1489 1532 1538 1539 1542 1552 
##    1555 1562 1564 1575 1580 1582 1589 1592 1604 1606 1607 1611 1612 1619 1623 
##    1649 1656 1667 1673 1684 1688 1690 1700 1705 1708 1728 1737 1738 1748 1750 
##    1765 1776 1791 1794 1820 1831 1837 1842 1846 1860 1870 1877 1882 1888 1895 
##    1904 1905 1945 1948 1951 1954 1958 1960 1963 1976 1978 1982 1989 1991 2006 
##    2015 2017 2050 2056 2059 2088 2095.
summary(fit_cfa,
        fit.measures = TRUE,
        standardized = TRUE)
## lavaan 0.6-21 ended normally after 85 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        51
## 
##                                                   Used       Total
##   Number of observations                          1901        2150
##   Number of missing patterns                        16            
## 
## Model Test User Model:
##                                                       
##   Test statistic                               809.524
##   Degrees of freedom                               101
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                             17143.971
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.958
##   Tucker-Lewis Index (TLI)                       0.951
##                                                       
##   Robust Comparative Fit Index (CFI)             0.958
##   Robust Tucker-Lewis Index (TLI)                0.951
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -25791.693
##   Loglikelihood unrestricted model (H1)     -25386.931
##                                                       
##   Akaike (AIC)                               51685.387
##   Bayesian (BIC)                             51968.444
##   Sample-size adjusted Bayesian (SABIC)      51806.417
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.061
##   90 Percent confidence interval - lower         0.057
##   90 Percent confidence interval - upper         0.065
##   P-value H_0: RMSEA <= 0.050                    0.000
##   P-value H_0: RMSEA >= 0.080                    0.000
##                                                       
##   Robust RMSEA                                   0.061
##   90 Percent confidence interval - lower         0.057
##   90 Percent confidence interval - upper         0.065
##   P-value H_0: Robust RMSEA <= 0.050             0.000
##   P-value H_0: Robust RMSEA >= 0.080             0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.027
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   SS =~                                                                 
##     SS_EMO            1.000                               0.621    0.797
##     SS_INS            0.982    0.024   41.369    0.000    0.610    0.856
##     SS_INF            0.978    0.026   38.030    0.000    0.608    0.807
##     SS_SOC            0.983    0.024   41.500    0.000    0.611    0.867
##   DEP =~                                                                
##     EMt09dpr013       1.000                               0.695    0.835
##     EMt09dpr014       1.022    0.025   41.293    0.000    0.711    0.803
##     EMt09dpr015       0.884    0.020   45.018    0.000    0.615    0.839
##     EMt09dpr016       1.076    0.030   36.227    0.000    0.748    0.737
##     EMt09dpr017       0.980    0.023   42.957    0.000    0.682    0.840
##     EMt09dpr018       0.832    0.021   39.540    0.000    0.579    0.792
##   PAR =~                                                                
##     EMt09crs001       1.000                               0.401    0.531
##     EMt09crs002       1.098    0.053   20.628    0.000    0.440    0.661
##     EMt09crs003       1.122    0.054   20.876    0.000    0.450    0.691
##     EMt09crs004       1.243    0.057   21.719    0.000    0.498    0.772
##     EMt09crs005       1.182    0.057   20.838    0.000    0.473    0.727
##     EMt09crs006       1.114    0.054   20.530    0.000    0.446    0.697
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   SS ~~                                                                 
##     DEP              -0.151    0.012  -12.637    0.000   -0.349   -0.349
##     PAR               0.103    0.008   12.532    0.000    0.414    0.414
##   DEP ~~                                                                
##     PAR              -0.107    0.009  -12.106    0.000   -0.384   -0.384
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .SS_EMO            3.836    0.018  214.192    0.000    3.836    4.921
##    .SS_INS            3.906    0.016  238.600    0.000    3.906    5.483
##    .SS_INF            3.806    0.017  220.006    0.000    3.806    5.057
##    .SS_SOC            3.875    0.016  239.492    0.000    3.875    5.503
##    .EMt09dpr013       1.898    0.019   99.172    0.000    1.898    2.279
##    .EMt09dpr014       2.085    0.020  102.439    0.000    2.085    2.354
##    .EMt09dpr015       1.740    0.017  103.389    0.000    1.740    2.376
##    .EMt09dpr016       2.341    0.023  100.397    0.000    2.341    2.307
##    .EMt09dpr017       1.810    0.019   97.076    0.000    1.810    2.231
##    .EMt09dpr018       1.664    0.017   99.139    0.000    1.664    2.279
##    .EMt09crs001       3.807    0.017  219.886    0.000    3.807    5.043
##    .EMt09crs002       3.915    0.015  256.328    0.000    3.915    5.882
##    .EMt09crs003       3.967    0.015  265.696    0.000    3.967    6.095
##    .EMt09crs004       4.049    0.015  273.423    0.000    4.049    6.271
##    .EMt09crs005       3.822    0.015  255.768    0.000    3.822    5.868
##    .EMt09crs006       3.809    0.015  259.088    0.000    3.809    5.943
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .SS_EMO            0.222    0.009   24.911    0.000    0.222    0.365
##    .SS_INS            0.135    0.006   21.429    0.000    0.135    0.267
##    .SS_INF            0.197    0.008   24.455    0.000    0.197    0.348
##    .SS_SOC            0.123    0.006   20.447    0.000    0.123    0.248
##    .EMt09dpr013       0.210    0.009   24.118    0.000    0.210    0.303
##    .EMt09dpr014       0.279    0.011   25.803    0.000    0.279    0.356
##    .EMt09dpr015       0.158    0.007   24.083    0.000    0.158    0.296
##    .EMt09dpr016       0.470    0.017   27.499    0.000    0.470    0.457
##    .EMt09dpr017       0.194    0.008   23.738    0.000    0.194    0.295
##    .EMt09dpr018       0.198    0.008   25.825    0.000    0.198    0.372
##    .EMt09crs001       0.409    0.014   28.647    0.000    0.409    0.718
##    .EMt09crs002       0.249    0.009   26.392    0.000    0.249    0.563
##    .EMt09crs003       0.221    0.009   25.738    0.000    0.221    0.523
##    .EMt09crs004       0.169    0.007   22.896    0.000    0.169    0.404
##    .EMt09crs005       0.200    0.008   24.486    0.000    0.200    0.472
##    .EMt09crs006       0.211    0.008   25.573    0.000    0.211    0.515
##     SS                0.386    0.019   20.194    0.000    1.000    1.000
##     DEP               0.483    0.022   21.821    0.000    1.000    1.000
##     PAR               0.161    0.014   11.548    0.000    1.000    1.000
fitMeasures(fit_cfa, c("chisq", "df", "pvalue",
                       "cfi", "tli", "rmsea",
                       "rmsea.ci.lower", "rmsea.ci.upper",
                       "srmr"))
##          chisq             df         pvalue            cfi            tli 
##        809.524        101.000          0.000          0.958          0.951 
##          rmsea rmsea.ci.lower rmsea.ci.upper           srmr 
##          0.061          0.057          0.065          0.027
# ══════════════════════════════════════════════════════
# STEP 2. 
# 측정모형 수정 탐색
# ══════════════════════════════════════════════════════

modindices(fit_cfa, 
           sort. = TRUE,      # MI 값 큰 순서로 정렬
           maximum.number = 20) # 상위 20개만 출력
##             lhs op         rhs      mi    epc sepc.lv sepc.all sepc.nox
## 182 EMt09dpr017 ~~ EMt09dpr018 235.942  0.090   0.090    0.460    0.460
## 145 EMt09dpr013 ~~ EMt09dpr015 179.558  0.078   0.078    0.427    0.427
## 156 EMt09dpr014 ~~ EMt09dpr016 116.184  0.106   0.106    0.294    0.294
## 209 EMt09crs005 ~~ EMt09crs006  93.292  0.060   0.060    0.292    0.292
## 147 EMt09dpr013 ~~ EMt09dpr017  75.249 -0.056  -0.056   -0.277   -0.277
## 195 EMt09crs001 ~~ EMt09crs002  64.639  0.067   0.067    0.209    0.209
## 200 EMt09crs002 ~~ EMt09crs003  45.764  0.045   0.045    0.191    0.191
## 148 EMt09dpr013 ~~ EMt09dpr018  45.281 -0.041  -0.041   -0.200   -0.200
## 205 EMt09crs003 ~~ EMt09crs005  37.127 -0.039  -0.039   -0.183   -0.183
## 165 EMt09dpr015 ~~ EMt09dpr016  34.180 -0.045  -0.045   -0.166   -0.166
## 202 EMt09crs002 ~~ EMt09crs005  32.895 -0.037  -0.037   -0.168   -0.168
## 158 EMt09dpr014 ~~ EMt09dpr018  31.193 -0.037  -0.037   -0.159   -0.159
## 175 EMt09dpr016 ~~ EMt09dpr018  29.714 -0.045  -0.045   -0.147   -0.147
## 198 EMt09crs001 ~~ EMt09crs005  25.953 -0.040  -0.040   -0.139   -0.139
## 166 EMt09dpr015 ~~ EMt09dpr017  20.126 -0.025  -0.025   -0.144   -0.144
## 207 EMt09crs004 ~~ EMt09crs005  19.857  0.028   0.028    0.151    0.151
## 70          DEP =~      SS_EMO  14.435 -0.074  -0.052   -0.066   -0.066
## 63           SS =~ EMt09dpr018  13.828 -0.075  -0.047   -0.064   -0.064
## 119      SS_INF ~~      SS_SOC  12.263  0.022   0.022    0.141    0.141
## 155 EMt09dpr014 ~~ EMt09dpr015  12.035 -0.022  -0.022   -0.105   -0.105
# ══════════════════════════════════════════════════════
# STEP 3. 
# 수정 측정모형 재설정
# ══════════════════════════════════════════════════════

model_cfa2 <- '
  SS   =~ SS_EMO + SS_INS + SS_INF + SS_SOC
  DEP =~ EMt09dpr013 + EMt09dpr014 + EMt09dpr015 +
           EMt09dpr016 + EMt09dpr017 + EMt09dpr018
  PAR  =~ EMt09crs001 + EMt09crs002 + EMt09crs003 +
           EMt09crs004 + EMt09crs005 + EMt09crs006
  EMt09dpr014 ~~ EMt09dpr016         
'

fit_cfa2 <- cfa(model_cfa2, data = data,
               estimator = "ML",
               missing = "fiml",
               fixed.x = FALSE)
## Warning: lavaan->lav_data_full():  
##    some cases are empty and will be ignored: 16 17 18 21 28 47 56 64 67 81 99 
##    105 108 110 113 125 127 129 136 137 161 166 173 175 182 198 204 224 225 
##    227 235 252 261 262 266 282 294 298 303 311 319 320 324 330 337 345 348 
##    349 353 361 366 370 379 388 389 392 405 419 423 439 445 467 468 480 486 
##    489 495 503 521 535 547 551 559 583 587 590 610 612 630 632 634 653 671 
##    674 676 693 699 700 710 721 722 731 747 756 763 765 771 772 780 781 782 
##    787 790 793 829 836 840 851 853 864 869 882 886 892 893 897 898 902 914 
##    916 919 922 924 928 930 931 937 939 941 948 952 973 976 978 979 1054 1081 
##    1123 1128 1146 1151 1162 1173 1182 1192 1241 1282 1299 1301 1306 1307 1310 
##    1316 1329 1338 1350 1358 1360 1363 1375 1378 1390 1394 1402 1407 1409 1414 
##    1418 1422 1433 1435 1440 1444 1451 1454 1467 1489 1532 1538 1539 1542 1552 
##    1555 1562 1564 1575 1580 1582 1589 1592 1604 1606 1607 1611 1612 1619 1623 
##    1649 1656 1667 1673 1684 1688 1690 1700 1705 1708 1728 1737 1738 1748 1750 
##    1765 1776 1791 1794 1820 1831 1837 1842 1846 1860 1870 1877 1882 1888 1895 
##    1904 1905 1945 1948 1951 1954 1958 1960 1963 1976 1978 1982 1989 1991 2006 
##    2015 2017 2050 2056 2059 2088 2095.
summary(fit_cfa2,
        fit.measures = TRUE,
        standardized = TRUE)
## lavaan 0.6-21 ended normally after 82 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        52
## 
##                                                   Used       Total
##   Number of observations                          1901        2150
##   Number of missing patterns                        16            
## 
## Model Test User Model:
##                                                       
##   Test statistic                               697.119
##   Degrees of freedom                               100
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                             17143.971
##   Degrees of freedom                               120
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.965
##   Tucker-Lewis Index (TLI)                       0.958
##                                                       
##   Robust Comparative Fit Index (CFI)             0.965
##   Robust Tucker-Lewis Index (TLI)                0.958
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -25735.491
##   Loglikelihood unrestricted model (H1)     -25386.931
##                                                       
##   Akaike (AIC)                               51574.982
##   Bayesian (BIC)                             51863.589
##   Sample-size adjusted Bayesian (SABIC)      51698.385
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.056
##   90 Percent confidence interval - lower         0.052
##   90 Percent confidence interval - upper         0.060
##   P-value H_0: RMSEA <= 0.050                    0.005
##   P-value H_0: RMSEA >= 0.080                    0.000
##                                                       
##   Robust RMSEA                                   0.056
##   90 Percent confidence interval - lower         0.052
##   90 Percent confidence interval - upper         0.060
##   P-value H_0: Robust RMSEA <= 0.050             0.005
##   P-value H_0: Robust RMSEA >= 0.080             0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.026
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Observed
##   Observed information based on                Hessian
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   SS =~                                                                 
##     SS_EMO            1.000                               0.621    0.797
##     SS_INS            0.982    0.024   41.373    0.000    0.610    0.856
##     SS_INF            0.978    0.026   38.028    0.000    0.608    0.807
##     SS_SOC            0.983    0.024   41.502    0.000    0.611    0.867
##   DEP =~                                                                
##     EMt09dpr013       1.000                               0.696    0.836
##     EMt09dpr014       0.996    0.025   39.804    0.000    0.694    0.783
##     EMt09dpr015       0.890    0.020   45.483    0.000    0.620    0.846
##     EMt09dpr016       1.037    0.030   34.429    0.000    0.722    0.712
##     EMt09dpr017       0.982    0.023   42.522    0.000    0.683    0.842
##     EMt09dpr018       0.839    0.021   39.567    0.000    0.584    0.800
##   PAR =~                                                                
##     EMt09crs001       1.000                               0.401    0.531
##     EMt09crs002       1.098    0.053   20.629    0.000    0.440    0.661
##     EMt09crs003       1.122    0.054   20.878    0.000    0.450    0.691
##     EMt09crs004       1.243    0.057   21.719    0.000    0.498    0.772
##     EMt09crs005       1.181    0.057   20.837    0.000    0.473    0.727
##     EMt09crs006       1.114    0.054   20.531    0.000    0.446    0.697
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .EMt09dpr014 ~~                                                        
##    .EMt09dpr016       0.106    0.011    9.664    0.000    0.106    0.271
##   SS ~~                                                                 
##     DEP              -0.152    0.012  -12.683    0.000   -0.351   -0.351
##     PAR               0.103    0.008   12.533    0.000    0.414    0.414
##   DEP ~~                                                                
##     PAR              -0.107    0.009  -12.103    0.000   -0.385   -0.385
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .SS_EMO            3.836    0.018  214.191    0.000    3.836    4.921
##    .SS_INS            3.906    0.016  238.598    0.000    3.906    5.483
##    .SS_INF            3.806    0.017  220.004    0.000    3.806    5.057
##    .SS_SOC            3.875    0.016  239.490    0.000    3.875    5.503
##    .EMt09dpr013       1.898    0.019   99.172    0.000    1.898    2.279
##    .EMt09dpr014       2.085    0.020  102.438    0.000    2.085    2.354
##    .EMt09dpr015       1.740    0.017  103.390    0.000    1.740    2.376
##    .EMt09dpr016       2.341    0.023  100.395    0.000    2.341    2.307
##    .EMt09dpr017       1.810    0.019   97.077    0.000    1.810    2.231
##    .EMt09dpr018       1.664    0.017   99.140    0.000    1.664    2.279
##    .EMt09crs001       3.807    0.017  219.886    0.000    3.807    5.043
##    .EMt09crs002       3.915    0.015  256.327    0.000    3.915    5.882
##    .EMt09crs003       3.967    0.015  265.696    0.000    3.967    6.095
##    .EMt09crs004       4.049    0.015  273.423    0.000    4.049    6.271
##    .EMt09crs005       3.822    0.015  255.769    0.000    3.822    5.868
##    .EMt09crs006       3.809    0.015  259.088    0.000    3.809    5.943
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .SS_EMO            0.222    0.009   24.912    0.000    0.222    0.365
##    .SS_INS            0.135    0.006   21.425    0.000    0.135    0.267
##    .SS_INF            0.197    0.008   24.459    0.000    0.197    0.348
##    .SS_SOC            0.123    0.006   20.449    0.000    0.123    0.248
##    .EMt09dpr013       0.209    0.009   23.414    0.000    0.209    0.301
##    .EMt09dpr014       0.303    0.012   26.101    0.000    0.303    0.387
##    .EMt09dpr015       0.152    0.007   23.102    0.000    0.152    0.284
##    .EMt09dpr016       0.508    0.018   27.594    0.000    0.508    0.493
##    .EMt09dpr017       0.191    0.008   22.903    0.000    0.191    0.291
##    .EMt09dpr018       0.192    0.008   25.107    0.000    0.192    0.360
##    .EMt09crs001       0.409    0.014   28.646    0.000    0.409    0.718
##    .EMt09crs002       0.249    0.009   26.391    0.000    0.249    0.563
##    .EMt09crs003       0.221    0.009   25.735    0.000    0.221    0.523
##    .EMt09crs004       0.169    0.007   22.896    0.000    0.169    0.405
##    .EMt09crs005       0.200    0.008   24.490    0.000    0.200    0.472
##    .EMt09crs006       0.211    0.008   25.571    0.000    0.211    0.515
##     SS                0.386    0.019   20.195    0.000    1.000    1.000
##     DEP               0.485    0.022   21.775    0.000    1.000    1.000
##     PAR               0.161    0.014   11.549    0.000    1.000    1.000
fitMeasures(fit_cfa2, c("chisq", "df", "pvalue",
                       "cfi", "tli", "rmsea",
                       "rmsea.ci.lower", "rmsea.ci.upper",
                       "srmr"))
##          chisq             df         pvalue            cfi            tli 
##        697.119        100.000          0.000          0.965          0.958 
##          rmsea rmsea.ci.lower rmsea.ci.upper           srmr 
##          0.056          0.052          0.060          0.026
# ══════════════════════════════════════════════════════
# STEP 4. 
# 모형비교
# ══════════════════════════════════════════════════════

lavTestLRT(fit_cfa, fit_cfa2)
## 
## Chi-Squared Difference Test
## 
##           Df   AIC   BIC  Chisq Chisq diff Df diff Pr(>Chisq)    
## fit_cfa2 100 51575 51864 697.12                                  
## fit_cfa  101 51685 51968 809.52     112.41       1  < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# ══════════════════════════════════════════════════════
# STEP 5. 
# 측정모형 그림그리기
# ══════════════════════════════════════════════════════

figure <- semPaths(fit_cfa2, what = "std",
         layout = "tree2",
         edge.label.cex = 0.8,
         residuals = TRUE,
         title = TRUE)