## Meghan Sullivan
## Chong Xing
## 2017-06-01
## SEM Examples for Using Likert Items from hbsc Data
## Section-1: One-Factor Categorical CFA (with Likert Items)
## Section-2: Three-Factor Categorical CFA (Likert)
## Section-3: Two-Factor Categorical Structural Model (Likert)
## Section-4: Indirect-Effect (Mediation) Structural Model (Likert)
## Section-5: One-Factor Two-Group Measurement Invariance Testing (Likert)
wdir <- "workingdata"
ddir <- "../../data"
odir <- "output"
library(kutils)
library(foreign)
library(lavaan)
## This is lavaan 0.5-22
## lavaan is BETA software! Please report any bugs.
pdf.options(onefile=FALSE, family="Times", paper="special", height=4,
width=6, pointsize=10)
## Read in Data
hbsc <- readRDS(file = file.path(ddir, "hbsc-subset.rds"))
summary(hbsc)
## StudentID SchoolID Gender Age
## Min. : 1 Min. : 1.0 Male :4456 Min. :11.00
## 1st Qu.:2308 1st Qu.: 59.0 Female:4742 1st Qu.:12.00
## Median :4614 Median :113.0 NA's : 29 Median :13.00
## Mean :4614 Mean :114.7 Mean :13.42
## 3rd Qu.:6920 3rd Qu.:171.0 3rd Qu.:15.00
## Max. :9227 Max. :227.0 Max. :17.00
## NA's :126
## Grade Race BodyFeelings1_f
## Grade_6 :2404 White :4030 s agree :2498
## Grade_7 :1880 Other :1960 agree :1849
## Grade_8 :1830 Black or African American:1692 undecided :1495
## Grade_9 :1486 Two or more races : 893 not agree :1239
## Grade_10:1627 Asian : 261 s not agree: 761
## (Other) : 240 NA's :1385
## NA's : 151
## BodyFeelings1_i BodyFeelings2_f BodyFeelings2_i BodyFeelings3_f
## Min. :0.000 s not agree: 662 Min. :0.000 s agree :4399
## 1st Qu.:0.000 not agree :1133 1st Qu.:2.000 agree :1562
## Median :1.000 undecided :1520 Median :3.000 undecided : 824
## Mean :1.479 agree :2733 Mean :2.488 not agree : 546
## 3rd Qu.:3.000 s agree :1771 3rd Qu.:3.000 s not agree: 487
## Max. :4.000 NA's :1408 Max. :4.000 NA's :1409
## NA's :1385 NA's :1408
## BodyFeelings3_i BodyFeelings4_f BodyFeelings4_i BodyFeelings5_f
## Min. :0.0000 s not agree: 766 Min. :0.000 s agree :4799
## 1st Qu.:0.0000 not agree : 901 1st Qu.:2.000 agree :1325
## Median :0.0000 undecided :1272 Median :3.000 undecided : 860
## Mean :0.8693 agree :2535 Mean :2.614 not agree : 427
## 3rd Qu.:1.0000 s agree :2349 3rd Qu.:4.000 s not agree: 411
## Max. :4.0000 NA's :1404 Max. :4.000 NA's :1405
## NA's :1409 NA's :1404
## BodyFeelings5_i PhysHealth1_f PhysHealth1_i
## Min. :0.0000 everyday : 706 Min. :0.000
## 1st Qu.:0.0000 every week :1177 1st Qu.:2.000
## Median :0.0000 More than once a week: 908 Median :3.000
## Mean :0.7632 every month :2474 Mean :2.828
## 3rd Qu.:1.0000 never :3817 3rd Qu.:4.000
## Max. :4.0000 NA's : 145 Max. :4.000
## NA's :1405 NA's :145
## PhysHealth2_f PhysHealth2_i PhysHealth3_f
## everyday : 421 Min. :0.000 everyday : 762
## every week : 895 1st Qu.:3.000 every week : 859
## More than once a week: 884 Median :3.000 More than once a week: 847
## every month :2887 Mean :3.004 every month :1695
## never :3976 3rd Qu.:4.000 never :4878
## NA's : 164 Max. :4.000 NA's : 186
## NA's :164
## PhysHealth3_i PhysHealth4_f PhysHealth4_i
## Min. :0.000 everyday : 754 Min. :0.000
## 1st Qu.:2.000 every week : 796 1st Qu.:2.000
## Median :4.000 More than once a week: 827 Median :4.000
## Mean :3.003 every month :1779 Mean :3.018
## 3rd Qu.:4.000 never :4840 3rd Qu.:4.000
## Max. :4.000 NA's : 231 Max. :4.000
## NA's :186 NA's :231
## PhysHealth5_f PhysHealth5_i PhysHealth6_f
## everyday :1186 Min. :0.000 everyday : 932
## every week :1351 1st Qu.:1.000 every week :1235
## More than once a week:1208 Median :3.000 More than once a week:1365
## every month :2224 Mean :2.512 every month :2190
## never :3062 3rd Qu.:4.000 never :3294
## NA's : 196 Max. :4.000 NA's : 211
## NA's :196
## PhysHealth6_i PhysHealth7_f PhysHealth7_i
## Min. :0.00 everyday :1477 Min. :0.000
## 1st Qu.:2.00 every week :1036 1st Qu.:1.000
## Median :3.00 More than once a week: 912 Median :3.000
## Mean :2.63 every month :1394 Mean :2.648
## 3rd Qu.:4.00 never :4228 3rd Qu.:4.000
## Max. :4.00 NA's : 180 Max. :4.000
## NA's :211 NA's :180
## PhysHealth8_f PhysHealth8_i Depress1_f
## everyday : 533 Min. :0.000 Never :2343
## every week : 640 1st Qu.:3.000 Seldom :2519
## More than once a week: 594 Median :4.000 Sometimes:2792
## every month :1349 Mean :3.271 Often :1030
## never :5924 3rd Qu.:4.000 Always : 386
## NA's : 187 Max. :4.000 NA's : 157
## NA's :187
## Depress1_i Depress2_f Depress2_i Depress3_f
## Min. :0.000 Never :1420 Min. :0.000 Never :5077
## 1st Qu.:2.000 Seldom :2083 1st Qu.:2.000 Seldom :1482
## Median :3.000 Sometimes:3321 Median :2.000 Sometimes:1331
## Mean :2.596 Often :1640 Mean :2.232 Often : 659
## 3rd Qu.:4.000 Always : 592 3rd Qu.:3.000 Always : 494
## Max. :4.000 NA's : 171 Max. :4.000 NA's : 184
## NA's :157 NA's :171
## Depress3_i Depress4_f Depress4_i Depress5_f
## Min. :0.000 Never :3948 Min. :0.000 Never :2974
## 1st Qu.:2.000 Seldom :1375 1st Qu.:2.000 Seldom :1667
## Median :4.000 Sometimes:1904 Median :3.000 Sometimes:2086
## Mean :3.105 Often :1091 Mean :2.751 Often :1315
## 3rd Qu.:4.000 Always : 702 3rd Qu.:4.000 Always : 969
## Max. :4.000 NA's : 207 Max. :4.000 NA's : 216
## NA's :184 NA's :207
## Depress5_i Depress6_f Depress6_i GotBully1_f
## Min. :0.000 Never :2524 Min. :0.000 havn't been :5116
## 1st Qu.:1.000 Seldom :1828 1st Qu.:1.000 1 or 2 :1442
## Median :3.000 Sometimes:2301 Median :2.000 2 or 3 a month : 350
## Mean :2.484 Often :1316 Mean :2.376 1 a week : 320
## 3rd Qu.:4.000 Always :1079 3rd Qu.:4.000 Several in a week: 507
## Max. :4.000 NA's : 179 Max. :4.000 NA's :1492
## NA's :216 NA's :179
## GotBully1_i GotBully2_f GotBully2_i
## Min. :0.0000 havn't been :5616 Min. :0.0000
## 1st Qu.:0.0000 1 or 2 :1189 1st Qu.:0.0000
## Median :0.0000 2 or 3 a month : 311 Median :0.0000
## Mean :0.6632 1 a week : 283 Mean :0.5118
## 3rd Qu.:1.0000 Several in a week: 323 3rd Qu.:1.0000
## Max. :4.0000 NA's :1505 Max. :4.0000
## NA's :1492 NA's :1505
## GotBully3_f GotBully3_i GotBully4_f
## havn't been :6591 Min. :0.0000 havn't been :5089
## 1 or 2 : 585 1st Qu.:0.0000 1 or 2 :1570
## 2 or 3 a month : 186 Median :0.0000 2 or 3 a month : 409
## 1 a week : 145 Mean :0.2815 1 a week : 268
## Several in a week: 194 3rd Qu.:0.0000 Several in a week: 382
## NA's :1526 Max. :4.0000 NA's :1509
## NA's :1526
## GotBully4_i GotBully5_f GotBully5_i
## Min. :0.0000 havn't been :6624 Min. :0.0000
## 1st Qu.:0.0000 1 or 2 : 537 1st Qu.:0.0000
## Median :0.0000 2 or 3 a month : 171 Median :0.0000
## Mean :0.6116 1 a week : 151 Mean :0.2785
## 3rd Qu.:1.0000 Several in a week: 202 3rd Qu.:0.0000
## Max. :4.0000 NA's :1542 Max. :4.0000
## NA's :1509 NA's :1542
## GotBully6_f GotBully6_i GotBully7_f
## havn't been :6944 Min. :0.0000 havn't been :5728
## 1 or 2 : 365 1st Qu.:0.0000 1 or 2 : 979
## 2 or 3 a month : 129 Median :0.0000 2 or 3 a month : 345
## 1 a week : 105 Mean :0.1895 1 a week : 281
## Several in a week: 129 3rd Qu.:0.0000 Several in a week: 358
## NA's :1555 Max. :4.0000 NA's :1536
## NA's :1555
## GotBully7_i GotBully8_f GotBully8_i
## Min. :0.0000 havn't been :7036 Min. :0.0000
## 1st Qu.:0.0000 1 or 2 : 348 1st Qu.:0.0000
## Median :0.0000 2 or 3 a month : 112 Median :0.0000
## Mean :0.5128 1 a week : 74 Mean :0.1592
## 3rd Qu.:1.0000 Several in a week: 107 3rd Qu.:0.0000
## Max. :4.0000 NA's :1550 Max. :4.0000
## NA's :1536 NA's :1550
## GotBully9_f GotBully9_i BullyOth1_f
## havn't been :7194 Min. :0.0000 havn't :4994
## 1 or 2 : 245 1st Qu.:0.0000 1 or 2 :1806
## 2 or 3 a month : 82 Median :0.0000 2 or 3 a month : 331
## 1 a week : 60 Mean :0.1303 1 a week : 255
## Several in a week: 103 3rd Qu.:0.0000 Several in a week: 305
## NA's :1543 Max. :4.0000 NA's :1536
## NA's :1543
## BullyOth1_i BullyOth2_f BullyOth2_i
## Min. :0.000 havn't :5810 Min. :0.0000
## 1st Qu.:0.000 1 or 2 :1222 1st Qu.:0.0000
## Median :0.000 2 or 3 a month : 260 Median :0.0000
## Mean :0.579 1 a week : 185 Mean :0.3997
## 3rd Qu.:1.000 Several in a week: 192 3rd Qu.:0.0000
## Max. :4.000 NA's :1558 Max. :4.0000
## NA's :1536 NA's :1558
## BullyOth3_f BullyOth3_i BullyOth4_f
## havn't :6529 Min. :0.0000 havn't :6719
## 1 or 2 : 633 1st Qu.:0.0000 1 or 2 : 558
## 2 or 3 a month : 195 Median :0.0000 2 or 3 a month : 133
## 1 a week : 142 Mean :0.2664 1 a week : 124
## Several in a week: 147 3rd Qu.:0.0000 Several in a week: 114
## NA's :1581 Max. :4.0000 NA's :1579
## NA's :1581
## BullyOth4_i BullyOth5_f BullyOth5_i
## Min. :0.000 havn't :6946 Min. :0.0000
## 1st Qu.:0.000 1 or 2 : 370 1st Qu.:0.0000
## Median :0.000 2 or 3 a month : 116 Median :0.0000
## Mean :0.216 1 a week : 102 Mean :0.1853
## 3rd Qu.:0.000 Several in a week: 128 3rd Qu.:0.0000
## Max. :4.000 NA's :1565 Max. :4.0000
## NA's :1579 NA's :1565
## BullyOth6_f BullyOth6_i BullyOth7_f
## havn't :7153 Min. :0.0000 havn't :6611
## 1 or 2 : 211 1st Qu.:0.0000 1 or 2 : 568
## 2 or 3 a month : 121 Median :0.0000 2 or 3 a month : 189
## 1 a week : 84 Mean :0.1375 1 a week : 114
## Several in a week: 87 3rd Qu.:0.0000 Several in a week: 165
## NA's :1571 Max. :4.0000 NA's :1580
## NA's :1571
## BullyOth7_i BullyOth8_f BullyOth8_i
## Min. :0.0000 havn't :7120 Min. :0.0000
## 1st Qu.:0.0000 1 or 2 : 256 1st Qu.:0.0000
## Median :0.0000 2 or 3 a month : 109 Median :0.0000
## Mean :0.2547 1 a week : 76 Mean :0.1332
## 3rd Qu.:0.0000 Several in a week: 79 3rd Qu.:0.0000
## Max. :4.0000 NA's :1587 Max. :4.0000
## NA's :1580 NA's :1587
## BullyOth9_f BullyOth9_i Alc1_f
## havn't :7160 Min. :0.0000 Never :6853
## 1 or 2 : 231 1st Qu.:0.0000 Rarely :1322
## 2 or 3 a month : 89 Median :0.0000 Every month: 350
## 1 a week : 70 Mean :0.1317 Every week : 252
## Several in a week: 97 3rd Qu.:0.0000 Everyday : 90
## NA's :1580 Max. :4.0000 NA's : 360
## NA's :1580
## Alc1_i Alc2_f Alc2_i Alc3_f
## Min. :2.000 Never :6731 Min. :2.000 Never :6899
## 1st Qu.:2.000 Rarely :1643 1st Qu.:2.000 Rarely :1041
## Median :2.000 Every month: 237 Median :2.000 Every month: 426
## Mean :2.354 Every week : 162 Mean :2.325 Every week : 280
## 3rd Qu.:2.000 Everyday : 68 3rd Qu.:2.000 Everyday : 89
## Max. :6.000 NA's : 386 Max. :6.000 NA's : 492
## NA's :360 NA's :386
## Alc3_i Alc4_f Alc4_i Alc5_f
## Min. :2.000 Never :6238 Min. :2.000 Never :6530
## 1st Qu.:2.000 Rarely :1495 1st Qu.:2.000 Rarely :1411
## Median :2.000 Every month: 589 Median :2.000 Every month: 486
## Mean :2.354 Every week : 305 Mean :2.463 Every week : 307
## 3rd Qu.:2.000 Everyday : 115 3rd Qu.:3.000 Everyday : 107
## Max. :6.000 NA's : 485 Max. :6.000 NA's : 386
## NA's :492 NA's :485
## Alc5_i
## Min. :2.000
## 1st Qu.:2.000
## Median :2.000
## Mean :2.422
## 3rd Qu.:3.000
## Max. :6.000
## NA's :386
####---------------------------------------------####
#### Section-1: One-Factor CFA with Likert Items ####
####---------------------------------------------####
#### Three Versions of One-Factor CFA for Depression Items
#### A Six-Item Five-Point Likert Scale
#### ("Depress1_f" Coded as Factor Variable)
#### ("Deqpress1_i" Coded as Integer Varable)
#### peek() function in kutils package gives
#### a quick inspection of the variables
class(hbsc$Depress1_f)
## [1] "factor"
class(hbsc$Depress1_i)
## [1] "integer"
if(interactive()) peek(hbsc[ , c("Depress1_f", "Depress1_i", "Depress2_f", "Depress2_i",
"Depress3_f", "Depress3_i", "Depress4_f", "Depress4_i",
"Depress5_f", "Depress5_i", "Depress6_f", "Depress6_i")])
## Version 1 - ML Estimation with Factor Variables
## lavaan Gives an Error Message about Unordered Factor(s)
## lavaan will still Provide Parameter Estimates
## But NAs will be Assigned to Loglikelihood, AIC, and BIC
model.depress.factor <- '
depress =~ NA*Depress1_f + Depress2_f + Depress3_f + Depress4_f
+ Depress5_f + Depress6_f
depress ~~ 1*depress
'
fit.depress.ML.factor <- cfa(model = model.depress.factor, data = hbsc,
mimic = "Mplus", estimator = "ML")
## Warning in lav_data_full(data = data, group = group, group.label =
## group.label, : lavaan WARNING: unordered factor(s) with more than 2 levels
## detected in data: Depress1_f Depress2_f Depress3_f Depress4_f Depress5_f
## Depress6_f
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be ignored:
## 73 90 184 215 252 382 400 417 466 477 628 660 679 771 934 988 1015 1055 1073 1117 1132 1179 1360 1404 1447 1501 1571 1670 1709 1717 1739 1789 1790 1882 1922 1966 1998 2035 2137 2168 2375 2397 2505 2555 2563 2606 2623 2627 2636 2665 2715 2995 3032 3098 3213 3261 3271 3333 3410 3423 3457 3526 3550 3567 3568 3600 3782 3807 3950 3985 4092 4122 4141 4148 4209 4268 4320 4388 4415 4480 4693 4720 4804 4833 4850 4865 4884 4925 4973 5093 5101 5110 5276 5289 5303 5577 5753 5872 5942 5994 6053 6055 6089 6105 6181 6473 6501 6564 6599 7032 7114 7239 7344 7357 7531 7667 7823 7935 8034 8117 8133 8233 8356 8432 8443 8491 8493 8598 8607 8664 8763 8789 8816 8952 9041 9049 9132 9135 9159 9165
summary(fit.depress.ML.factor, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 23 iterations
##
## Used Total
## Number of observations 9087 9227
##
## Number of missing patterns 31
##
## Estimator ML
## Minimum Function Test Statistic 580.043
## Degrees of freedom 9
## P-value (Chi-square) 0.000
##
## Model test baseline model:
##
## Minimum Function Test Statistic 13929.900
## Degrees of freedom 15
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.959
## Tucker-Lewis Index (TLI) 0.932
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) NA
## Loglikelihood unrestricted model (H1) NA
##
## Number of free parameters 18
## Akaike (AIC) NA
## Bayesian (BIC) NA
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.084
## 90 Percent Confidence Interval 0.078 0.089
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.029
##
## Parameter Estimates:
##
## Information Observed
## Standard Errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress =~
## Depress1_f 0.776 0.011 67.706 0.000 0.776 0.697
## Depress2_f 0.703 0.012 59.854 0.000 0.703 0.630
## Depress3_f 0.809 0.013 63.982 0.000 0.809 0.664
## Depress4_f 0.879 0.014 63.232 0.000 0.879 0.661
## Depress5_f 0.779 0.015 53.051 0.000 0.779 0.573
## Depress6_f 0.761 0.014 52.768 0.000 0.761 0.567
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Depress1_f 2.405 0.012 205.715 0.000 2.405 2.159
## .Depress2_f 2.769 0.012 236.125 0.000 2.769 2.480
## .Depress3_f 1.895 0.013 148.219 0.000 1.895 1.558
## .Depress4_f 2.249 0.014 160.731 0.000 2.249 1.691
## .Depress5_f 2.516 0.014 175.938 0.000 2.516 1.852
## .Depress6_f 2.624 0.014 186.221 0.000 2.624 1.957
## depress 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress 1.000 1.000 1.000
## .Depress1_f 0.637 0.013 50.870 0.000 0.637 0.514
## .Depress2_f 0.752 0.013 56.089 0.000 0.752 0.603
## .Depress3_f 0.827 0.015 53.895 0.000 0.827 0.559
## .Depress4_f 0.997 0.019 53.696 0.000 0.997 0.563
## .Depress5_f 1.240 0.021 58.480 0.000 1.240 0.672
## .Depress6_f 1.220 0.021 59.224 0.000 1.220 0.678
## Version 2 - ML Estimation with Integer Variables
## The Error Message about Unordered Factor Is Gone
## Estimates on Loglikelihood, AIC, and BIC Are Provided
## All the Parameter Estimates Are Identical to the Version 1
model.depress.integer <- '
depress =~ NA*Depress1_i + Depress2_i + Depress3_i + Depress4_i
+ Depress5_i + Depress6_i
depress ~~ 1*depress
'
fit.depress.ML.integer <- cfa(model = model.depress.integer, data = hbsc,
mimic = "Mplus", estimator = "ML")
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be ignored:
## 63 69 93 96 179 187 276 412 439 465 564 621 630 735 737 785 796 872 995 1095 1111 1194 1293 1405 1561 1697 1871 1884 1989 2114 2196 2629 2664 2727 2755 3047 3123 3139 3173 3175 3234 3286 3356 3475 3651 3925 3939 3952 4118 4127 4135 4255 4303 4344 4363 4378 4395 4424 4508 4535 4748 4813 4840 4908 4960 5019 5080 5087 5106 5136 5243 5278 5421 5446 5628 5660 5661 5678 5702 5771 5805 5818 5895 5957 5967 6015 6130 6196 6233 6513 6563 6592 6601 6605 6622 6665 6673 6723 6831 6853 7060 7091 7193 7230 7262 7306 7346 7438 7439 7489 7511 7519 7558 7657 7727 7781 7824 7868 8049 8096 8111 8155 8173 8213 8240 8294 8457 8549 8568 8600 8751 8762 8811 8828 8846 8976 9013 9044 9138 9155
summary(fit.depress.ML.integer, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 25 iterations
##
## Used Total
## Number of observations 9087 9227
##
## Number of missing patterns 31
##
## Estimator ML
## Minimum Function Test Statistic 580.043
## Degrees of freedom 9
## P-value (Chi-square) 0.000
##
## Model test baseline model:
##
## Minimum Function Test Statistic 13929.900
## Degrees of freedom 15
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.959
## Tucker-Lewis Index (TLI) 0.932
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -82045.027
## Loglikelihood unrestricted model (H1) -81755.006
##
## Number of free parameters 18
## Akaike (AIC) 164126.054
## Bayesian (BIC) 164254.117
## Sample-size adjusted Bayesian (BIC) 164196.916
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.084
## 90 Percent Confidence Interval 0.078 0.089
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.029
##
## Parameter Estimates:
##
## Information Observed
## Standard Errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress =~
## Depress1_i 0.776 0.011 67.706 0.000 0.776 0.697
## Depress2_i 0.703 0.012 59.854 0.000 0.703 0.630
## Depress3_i 0.809 0.013 63.982 0.000 0.809 0.664
## Depress4_i 0.879 0.014 63.232 0.000 0.879 0.661
## Depress5_i 0.779 0.015 53.051 0.000 0.779 0.573
## Depress6_i 0.761 0.014 52.768 0.000 0.761 0.567
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Depress1_i 2.595 0.012 221.976 0.000 2.595 2.330
## .Depress2_i 2.231 0.012 190.300 0.000 2.231 1.999
## .Depress3_i 3.105 0.013 242.795 0.000 3.105 2.551
## .Depress4_i 2.751 0.014 196.564 0.000 2.751 2.067
## .Depress5_i 2.484 0.014 173.721 0.000 2.484 1.828
## .Depress6_i 2.376 0.014 168.570 0.000 2.376 1.771
## depress 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress 1.000 1.000 1.000
## .Depress1_i 0.637 0.013 50.870 0.000 0.637 0.514
## .Depress2_i 0.752 0.013 56.089 0.000 0.752 0.603
## .Depress3_i 0.827 0.015 53.895 0.000 0.827 0.559
## .Depress4_i 0.997 0.019 53.696 0.000 0.997 0.563
## .Depress5_i 1.240 0.021 58.480 0.000 1.240 0.672
## .Depress6_i 1.220 0.021 59.224 0.000 1.220 0.678
## Categorical Treatment of the Items (WLSMV)
## peek() Function Showed Items 1, 3, 4, 5, 6
## Were Not Normally Distributed (They Are Declared as "ordered")
fit.depress.WLSMV.factor <-
cfa(model = model.depress.factor, data = hbsc,
mimic = "Mplus", estimator = "WLSMV",
ordered = c("Depress1_f", "Depress2_f", "Depress3_f",
"Depress4_f", "Depress5_f", "Depress6_f"))
summary(fit.depress.WLSMV.factor, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 12 iterations
##
## Used Total
## Number of observations 8923 9227
##
## Estimator DWLS Robust
## Minimum Function Test Statistic 380.150 738.573
## Degrees of freedom 9 9
## P-value (Chi-square) 0.000 0.000
## Scaling correction factor 0.515
## Shift parameter 0.231
## for simple second-order correction (WLSMV)
##
## Model test baseline model:
##
## Minimum Function Test Statistic 42237.702 28021.369
## Degrees of freedom 15 15
## P-value 0.000 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.991 0.974
## Tucker-Lewis Index (TLI) 0.985 0.957
##
## Robust Comparative Fit Index (CFI) NA
## Robust Tucker-Lewis Index (TLI) NA
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.068 0.095
## 90 Percent Confidence Interval 0.062 0.074 0.090 0.101
## P-value RMSEA <= 0.05 0.000 0.000
##
## Robust RMSEA NA
## 90 Percent Confidence Interval NA NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.033 0.033
##
## Weighted Root Mean Square Residual:
##
## WRMR 3.122 3.122
##
## Parameter Estimates:
##
## Information Expected
## Standard Errors Robust.sem
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress =~
## Depress1_f 0.741 0.006 116.476 0.000 0.741 0.741
## Depress2_f 0.670 0.007 93.754 0.000 0.670 0.670
## Depress3_f 0.745 0.007 105.409 0.000 0.745 0.745
## Depress4_f 0.722 0.007 103.166 0.000 0.722 0.722
## Depress5_f 0.630 0.008 79.802 0.000 0.630 0.630
## Depress6_f 0.611 0.008 74.485 0.000 0.611 0.611
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Depress1_f 0.000 0.000 0.000
## .Depress2_f 0.000 0.000 0.000
## .Depress3_f 0.000 0.000 0.000
## .Depress4_f 0.000 0.000 0.000
## .Depress5_f 0.000 0.000 0.000
## .Depress6_f 0.000 0.000 0.000
## depress 0.000 0.000 0.000
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Depress1_f|t1 -0.653 0.014 -45.508 0.000 -0.653 -0.653
## Depress1_f|t2 0.090 0.013 6.785 0.000 0.090 0.090
## Depress1_f|t3 1.010 0.016 62.927 0.000 1.010 1.010
## Depress1_f|t4 1.719 0.024 73.030 0.000 1.719 1.719
## Depress2_f|t1 -1.006 0.016 -62.802 0.000 -1.006 -1.006
## Depress2_f|t2 -0.288 0.013 -21.407 0.000 -0.288 -0.288
## Depress2_f|t3 0.685 0.014 47.379 0.000 0.685 0.685
## Depress2_f|t4 1.512 0.021 73.550 0.000 1.512 1.512
## Depress3_f|t1 0.156 0.013 11.735 0.000 0.156 0.156
## Depress3_f|t2 0.600 0.014 42.334 0.000 0.600 0.600
## Depress3_f|t3 1.140 0.017 67.324 0.000 1.140 1.140
## Depress3_f|t4 1.602 0.022 73.654 0.000 1.602 1.602
## Depress4_f|t1 -0.155 0.013 -11.608 0.000 -0.155 -0.155
## Depress4_f|t2 0.230 0.013 17.145 0.000 0.230 0.230
## Depress4_f|t3 0.847 0.015 55.884 0.000 0.847 0.847
## Depress4_f|t4 1.420 0.019 72.891 0.000 1.420 1.420
## Depress5_f|t1 -0.438 0.014 -31.869 0.000 -0.438 -0.438
## Depress5_f|t2 0.039 0.013 2.975 0.003 0.039 0.039
## Depress5_f|t3 0.666 0.014 46.282 0.000 0.666 0.666
## Depress5_f|t4 1.242 0.018 69.977 0.000 1.242 1.242
## Depress6_f|t1 -0.585 0.014 -41.428 0.000 -0.585 -0.585
## Depress6_f|t2 -0.045 0.013 -3.398 0.001 -0.045 -0.045
## Depress6_f|t3 0.630 0.014 44.119 0.000 0.630 0.630
## Depress6_f|t4 1.180 0.017 68.468 0.000 1.180 1.180
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress 1.000 1.000 1.000
## .Depress1_f 0.451 0.451 0.451
## .Depress2_f 0.552 0.552 0.552
## .Depress3_f 0.445 0.445 0.445
## .Depress4_f 0.479 0.479 0.479
## .Depress5_f 0.603 0.603 0.603
## .Depress6_f 0.626 0.626 0.626
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Depress1_f 1.000 1.000 1.000
## Depress2_f 1.000 1.000 1.000
## Depress3_f 1.000 1.000 1.000
## Depress4_f 1.000 1.000 1.000
## Depress5_f 1.000 1.000 1.000
## Depress6_f 1.000 1.000 1.000
#### One-Factor CFA for Bullying Others Items (e.g., "BullyOth1")
#### A Nine-Item Five-Point Likert Scale
#### ("BullyOther1_f" Coded as Factor Variable)
#### ("BullyOther1_i" Coded as Integer Varable)
if(interactive()) peek(hbsc[ , c("BullyOth1_f", "BullyOth1_i", "BullyOth2_f", "BullyOth2_i",
"BullyOth3_f", "BullyOth3_i", "BullyOth4_f", "BullyOth4_i",
"BullyOth5_f", "BullyOth5_i", "BullyOth6_f", "BullyOth6_i",
"BullyOth7_f", "BullyOth7_i", "BullyOth8_f", "BullyOth8_i",
"BullyOth9_f", "BullyOth9_i")])
## Continuous Treatment of the Items (ML)
model.bullyOther.integer <- '
bullyOther =~ NA*BullyOth1_i + BullyOth2_i + BullyOth3_i
+ BullyOth4_i + BullyOth5_i + BullyOth6_i
+ BullyOth7_i + BullyOth8_i + BullyOth9_i
bullyOther ~~ 1*bullyOther
'
fit.bullyOther.ML.integer <-
cfa(model = model.bullyOther.integer, data = hbsc,
mimic = "Mplus", estimator = "ML")
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be ignored:
## 10 15 28 34 43 47 48 71 72 73 80 81 84 89 90 93 103 131 137 142 148 150 151 163 168 169 177 178 184 190 195 226 232 235 242 247 251 252 253 256 259 260 272 280 287 292 297 323 328 333 356 360 366 373 375 376 381 382 385 396 398 400 402 403 410 412 417 418 420 426 431 434 439 447 449 450 452 461 466 474 477 486 489 490 507 508 526 530 541 542 548 550 553 554 557 561 563 578 579 582 591 593 594 595 603 608 613 616 622 628 636 639 649 652 654 655 660 664 666 670 674 679 684 686 688 690 695 706 726 727 728 729 730 732 746 751 753 760 766 771 781 785 799 813 821 831 836 853 868 872 883 891 892 896 897 901 904 911 912 919 920 934 942 946 952 953 969 971 972 977 1000 1013 1015 1017 1023 1025 1043 1045 1048 1049 1052 1055 1056 1062 1063 1068 1072 1073 1076 1091 1092 1098 1101 1109 1110 1111 1120 1123 1125 1132 1144 1150 1156 1158 1160 1166 1171 1173 1179 1188 1190 1193 1196 1203 1204 1206 1213 1214 1216 1235 1247 1262 1272 1273 1285 1286 1287 1288 1302 1306 1314 1320 1330 1332 1348 1350 1352 1353 1354 1360 1363 1369 1377 1382 1385 1387 1390 1391 1396 1398 1404 1413 1419 1438 1441 1442 1447 1450 1454 1477 1479 1484 1487 1498 1508 1509 1512 1515 1516 1519 1521 1526 1527 1530 1534 1536 1537 1538 1539 1542 1553 1555 1558 1559 1560 1568 1569 1573 1577 1588 1594 1598 1601 1618 1623 1625 1628 1648 1656 1666 1670 1672 1681 1683 1688 1691 1693 1694 1695 1700 1708 1710 1712 1715 1717 1718 1730 1735 1739 1740 1741 1742 1747 1751 1752 1761 1772 1774 1787 1789 1790 1794 1798 1799 1805 1809 1813 1820 1832 1838 1843 1857 1864 1875 1879 1882 1897 1902 1903 1914 1921 1922 1927 1929 1945 1951 1953 1962 1963 1966 1967 1969 1971 1984 1988 1990 1997 1998 2003 2007 2009 2012 2014 2034 2040 2048 2059 2092 2108 2117 2125 2129 2137 2154 2156 2159 2167 2175 2176 2178 2186 2194 2202 2203 2217 2221 2223 2234 2242 2249 2264 2268 2282 2308 2309 2315 2319 2325 2338 2357 2360 2363 2364 2374 2380 2386 2387 2391 2397 2422 2436 2440 2444 2445 2447 2450 2454 2473 2478 2491 2496 2497 2505 2518 2521 2523 2524 2529 2544 2553 2556 2557 2563 2571 2587 2591 2601 2603 2606 2609 2623 2627 2636 2637 2645 2649 2660 2665 2672 2676 2695 2700 2703 2706 2708 2713 2716 2723 2736 2739 2744 2753 2764 2778 2782 2784 2788 2793 2794 2797 2799 2805 2807 2808 2812 2826 2829 2834 2838 2839 2856 2874 2887 2897 2898 2900 2908 2913 2932 2940 2949 2950 2960 2961 2976 2982 2988 2990 2992 2995 3003 3007 3032 3036 3038 3041 3044 3046 3049 3056 3061 3070 3079 3083 3090 3092 3098 3103 3110 3112 3134 3143 3149 3155 3158 3160 3164 3168 3170 3180 3182 3184 3190 3192 3198 3202 3209 3210 3214 3215 3216 3225 3234 3237 3240 3244 3245 3251 3256 3257 3262 3276 3280 3289 3292 3301 3305 3306 3316 3317 3333 3342 3345 3363 3378 3398 3399 3405 3408 3410 3413 3419 3423 3428 3432 3433 3439 3449 3457 3467 3480 3485 3486 3493 3494 3496 3505 3508 3513 3518 3522 3524 3539 3540 3542 3550 3551 3554 3566 3567 3568 3570 3580 3590 3594 3597 3600 3614 3616 3618 3619 3620 3625 3627 3637 3638 3645 3646 3649 3662 3671 3673 3685 3687 3690 3700 3705 3708 3711 3719 3720 3725 3731 3736 3745 3747 3748 3757 3758 3764 3765 3775 3776 3781 3782 3787 3793 3795 3796 3797 3800 3802 3809 3817 3818 3831 3836 3839 3860 3864 3870 3886 3889 3897 3902 3906 3908 3909 3914 3923 3949 3952 3958 3961 3968 3974 3975 3978 3979 3987 3991 3995 3999 4001 4012 4017 4033 4038 4043 4061 4065 4070 4080 4087 4092 4093 4098 4101 4104 4115 4122 4125 4127 4133 4137 4141 4148 4152 4155 4157 4161 4163 4164 4167 4179 4183 4201 4205 4209 4231 4238 4244 4248 4257 4262 4268 4282 4286 4288 4291 4292 4294 4303 4307 4319 4339 4343 4355 4356 4357 4361 4363 4378 4388 4393 4408 4412 4413 4415 4420 4421 4457 4458 4463 4469 4470 4471 4472 4477 4478 4480 4489 4491 4492 4494 4496 4501 4506 4516 4526 4535 4536 4538 4541 4542 4551 4552 4565 4566 4574 4576 4580 4586 4593 4610 4614 4624 4630 4638 4644 4648 4654 4655 4657 4658 4661 4667 4670 4671 4687 4692 4695 4699 4719 4720 4723 4732 4736 4741 4751 4759 4762 4770 4783 4788 4789 4791 4793 4794 4804 4807 4810 4818 4820 4826 4828 4833 4838 4865 4868 4884 4888 4901 4917 4920 4939 4943 4950 4956 4965 4966 4973 4977 4998 5016 5019 5028 5033 5034 5062 5068 5075 5080 5092 5093 5110 5111 5117 5122 5132 5136 5140 5144 5146 5153 5166 5169 5170 5176 5178 5181 5185 5187 5190 5199 5204 5212 5217 5232 5240 5241 5249 5259 5267 5274 5275 5276 5279 5291 5293 5303 5305 5327 5336 5367 5368 5378 5384 5385 5386 5392 5397 5423 5440 5445 5459 5463 5470 5474 5486 5496 5508 5511 5513 5518 5527 5529 5537 5538 5543 5550 5552 5553 5555 5556 5570 5575 5576 5577 5593 5599 5600 5601 5603 5615 5620 5632 5639 5641 5651 5658 5679 5682 5699 5709 5728 5733 5737 5753 5766 5772 5781 5785 5791 5801 5813 5816 5817 5825 5827 5837 5846 5847 5856 5861 5872 5874 5875 5909 5918 5924 5928 5938 5941 5942 5956 5959 5969 5982 5983 5986 5994 6003 6005 6022 6024 6031 6033 6037 6038 6039 6047 6053 6061 6068 6087 6088 6089 6102 6105 6117 6123 6133 6141 6170 6183 6184 6186 6205 6206 6210 6215 6216 6217 6220 6239 6249 6263 6275 6280 6282 6286 6291 6293 6294 6307 6310 6313 6316 6319 6328 6329 6337 6345 6348 6356 6361 6366 6372 6375 6376 6412 6421 6426 6434 6439 6441 6442 6445 6446 6452 6454 6457 6460 6465 6466 6467 6471 6473 6477 6488 6492 6499 6501 6515 6521 6524 6526 6545 6550 6551 6556 6559 6564 6595 6597 6599 6619 6624 6631 6633 6640 6643 6644 6646 6666 6673 6676 6679 6681 6686 6688 6689 6693 6695 6707 6708 6719 6726 6727 6739 6746 6749 6753 6782 6785 6788 6795 6796 6800 6801 6804 6816 6817 6827 6833 6834 6835 6852 6859 6869 6884 6885 6891 6896 6903 6909 6911 6917 6924 6933 6941 6942 6943 6950 6968 6971 6972 6976 6979 6987 6991 6996 6999 7002 7023 7027 7032 7036 7049 7064 7074 7081 7085 7088 7092 7099 7101 7112 7114 7122 7136 7142 7143 7148 7159 7162 7165 7173 7185 7186 7188 7220 7228 7234 7239 7254 7255 7259 7262 7265 7266 7271 7280 7288 7294 7298 7301 7311 7312 7332 7344 7347 7348 7351 7352 7353 7355 7358 7361 7367 7381 7386 7398 7406 7418 7420 7422 7438 7459 7461 7470 7471 7472 7479 7482 7484 7488 7489 7505 7514 7517 7518 7520 7525 7527 7530 7535 7536 7542 7547 7553 7559 7567 7571 7576 7577 7582 7607 7610 7612 7633 7641 7644 7648 7655 7662 7663 7667 7670 7687 7688 7691 7692 7708 7709 7717 7720 7721 7724 7731 7738 7742 7751 7761 7767 7776 7780 7787 7788 7792 7794 7798 7825 7840 7841 7858 7860 7862 7867 7879 7884 7904 7910 7921 7926 7931 7932 7943 7952 7959 7962 7969 7992 7996 7999 8003 8007 8012 8015 8019 8024 8031 8032 8034 8035 8041 8042 8043 8052 8064 8074 8078 8080 8089 8098 8108 8113 8115 8117 8119 8125 8127 8138 8143 8150 8153 8155 8159 8161 8169 8171 8175 8181 8184 8185 8190 8195 8198 8203 8209 8211 8222 8227 8231 8235 8238 8241 8242 8250 8269 8273 8275 8276 8281 8283 8291 8292 8296 8299 8300 8301 8304 8305 8307 8310 8316 8317 8319 8323 8336 8340 8341 8348 8358 8364 8388 8389 8396 8414 8416 8421 8438 8443 8457 8458 8466 8472 8485 8491 8493 8497 8506 8507 8518 8520 8526 8533 8534 8538 8541 8545 8553 8561 8570 8578 8584 8586 8595 8598 8603 8607 8618 8622 8626 8640 8641 8643 8646 8647 8648 8652 8664 8669 8670 8672 8676 8679 8684 8685 8686 8689 8698 8699 8703 8716 8724 8734 8740 8747 8764 8772 8789 8793 8799 8808 8811 8816 8823 8827 8833 8837 8850 8852 8864 8876 8887 8915 8919 8930 8933 8935 8937 8941 8944 8952 8953 8981 8982 8990 8996 9000 9018 9023 9026 9028 9033 9039 9040 9041 9049 9059 9061 9072 9078 9082 9090 9101 9114 9124 9132 9135 9141 9144 9149 9155 9156 9157 9159 9165 9166 9169 9170 9171 9173 9174 9177 9180 9189 9192 9201 9203 9208 9209 9211 9218 9220
summary(fit.bullyOther.ML.integer, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 36 iterations
##
## Used Total
## Number of observations 7700 9227
##
## Number of missing patterns 35
##
## Estimator ML
## Minimum Function Test Statistic 3185.539
## Degrees of freedom 27
## P-value (Chi-square) 0.000
##
## Model test baseline model:
##
## Minimum Function Test Statistic 37420.866
## Degrees of freedom 36
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.916
## Tucker-Lewis Index (TLI) 0.887
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -57435.643
## Loglikelihood unrestricted model (H1) -55842.873
##
## Number of free parameters 27
## Akaike (AIC) 114925.285
## Bayesian (BIC) 115112.907
## Sample-size adjusted Bayesian (BIC) 115027.107
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.123
## 90 Percent Confidence Interval 0.120 0.127
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.049
##
## Parameter Estimates:
##
## Information Observed
## Standard Errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## bullyOther =~
## BullyOth1_i 0.571 0.011 52.183 0.000 0.571 0.570
## BullyOth2_i 0.539 0.009 58.156 0.000 0.539 0.621
## BullyOth3_i 0.553 0.008 69.987 0.000 0.553 0.719
## BullyOth4_i 0.524 0.007 75.612 0.000 0.524 0.755
## BullyOth5_i 0.531 0.007 79.125 0.000 0.531 0.780
## BullyOth6_i 0.483 0.006 84.013 0.000 0.483 0.813
## BullyOth7_i 0.539 0.008 68.106 0.000 0.539 0.702
## BullyOth8_i 0.443 0.006 76.924 0.000 0.443 0.770
## BullyOth9_i 0.463 0.006 79.385 0.000 0.463 0.785
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .BullyOth1_i 0.580 0.011 50.710 0.000 0.580 0.578
## .BullyOth2_i 0.401 0.010 40.441 0.000 0.401 0.462
## .BullyOth3_i 0.270 0.009 30.669 0.000 0.270 0.350
## .BullyOth4_i 0.217 0.008 27.413 0.000 0.217 0.313
## .BullyOth5_i 0.187 0.008 24.036 0.000 0.187 0.274
## .BullyOth6_i 0.139 0.007 20.522 0.000 0.139 0.234
## .BullyOth7_i 0.256 0.009 29.254 0.000 0.256 0.334
## .BullyOth8_i 0.136 0.007 20.747 0.000 0.136 0.237
## .BullyOth9_i 0.134 0.007 19.920 0.000 0.134 0.227
## bullyOther 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## bullyOther 1.000 1.000 1.000
## .BullyOth1_i 0.679 0.012 58.838 0.000 0.679 0.675
## .BullyOth2_i 0.463 0.008 58.056 0.000 0.463 0.614
## .BullyOth3_i 0.287 0.005 55.382 0.000 0.287 0.484
## .BullyOth4_i 0.206 0.004 54.169 0.000 0.206 0.429
## .BullyOth5_i 0.181 0.003 52.770 0.000 0.181 0.391
## .BullyOth6_i 0.120 0.002 50.437 0.000 0.120 0.340
## .BullyOth7_i 0.299 0.005 56.156 0.000 0.299 0.507
## .BullyOth8_i 0.135 0.003 52.922 0.000 0.135 0.407
## .BullyOth9_i 0.133 0.003 51.999 0.000 0.133 0.383
## Categorical Treatment of the Items (WLSMV)
model.bullyOther.factor <- '
bullyOther =~ NA*BullyOth1_f + BullyOth2_f + BullyOth3_f
+ BullyOth4_f + BullyOth5_f + BullyOth6_f
+ BullyOth7_f + BullyOth8_f + BullyOth9_f
bullyOther ~~ 1*bullyOther
'
fit.bullyOther.WLSMV.factor <-
cfa(model = model.bullyOther.factor, data = hbsc,
mimic = "Mplus", estimator = "WLSMV",
ordered = c("BullyOth1_f", "BullyOth2_f",
"BullyOth3_f", "BullyOth4_f",
"BullyOth5_f", "BullyOth6_f",
"BullyOth7_f", "BullyOth8_f",
"BullyOth9_f"))
summary(fit.bullyOther.WLSMV.factor, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 14 iterations
##
## Used Total
## Number of observations 7522 9227
##
## Estimator DWLS Robust
## Minimum Function Test Statistic 371.833 760.315
## Degrees of freedom 27 27
## P-value (Chi-square) 0.000 0.000
## Scaling correction factor 0.492
## Shift parameter 4.128
## for simple second-order correction (WLSMV)
##
## Model test baseline model:
##
## Minimum Function Test Statistic 131752.160 51683.289
## Degrees of freedom 36 36
## P-value 0.000 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.997 0.986
## Tucker-Lewis Index (TLI) 0.997 0.981
##
## Robust Comparative Fit Index (CFI) NA
## Robust Tucker-Lewis Index (TLI) NA
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.041 0.060
## 90 Percent Confidence Interval 0.038 0.045 0.056 0.064
## P-value RMSEA <= 0.05 1.000 0.000
##
## Robust RMSEA NA
## 90 Percent Confidence Interval NA NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.034 0.034
##
## Weighted Root Mean Square Residual:
##
## WRMR 2.273 2.273
##
## Parameter Estimates:
##
## Information Expected
## Standard Errors Robust.sem
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## bullyOther =~
## BullyOth1_f 0.743 0.009 80.842 0.000 0.743 0.743
## BullyOth2_f 0.778 0.009 86.542 0.000 0.778 0.778
## BullyOth3_f 0.842 0.008 108.802 0.000 0.842 0.842
## BullyOth4_f 0.857 0.007 115.833 0.000 0.857 0.857
## BullyOth5_f 0.894 0.007 132.362 0.000 0.894 0.894
## BullyOth6_f 0.938 0.006 157.584 0.000 0.938 0.938
## BullyOth7_f 0.835 0.008 100.650 0.000 0.835 0.835
## BullyOth8_f 0.914 0.007 137.786 0.000 0.914 0.914
## BullyOth9_f 0.928 0.006 148.946 0.000 0.928 0.928
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .BullyOth1_f 0.000 0.000 0.000
## .BullyOth2_f 0.000 0.000 0.000
## .BullyOth3_f 0.000 0.000 0.000
## .BullyOth4_f 0.000 0.000 0.000
## .BullyOth5_f 0.000 0.000 0.000
## .BullyOth6_f 0.000 0.000 0.000
## .BullyOth7_f 0.000 0.000 0.000
## .BullyOth8_f 0.000 0.000 0.000
## .BullyOth9_f 0.000 0.000 0.000
## bullyOther 0.000 0.000 0.000
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## BullyOth1_f|t1 0.393 0.015 26.446 0.000 0.393 0.393
## BullyOth1_f|t2 1.209 0.019 63.543 0.000 1.209 1.209
## BullyOth1_f|t3 1.468 0.022 67.306 0.000 1.468 1.468
## BullyOth1_f|t4 1.768 0.027 66.591 0.000 1.768 1.768
## BullyOth2_f|t1 0.711 0.016 44.812 0.000 0.711 0.711
## BullyOth2_f|t2 1.403 0.021 66.754 0.000 1.403 1.403
## BullyOth2_f|t3 1.670 0.025 67.384 0.000 1.670 1.670
## BullyOth2_f|t4 1.969 0.031 63.444 0.000 1.969 1.969
## BullyOth3_f|t1 1.069 0.018 59.749 0.000 1.069 1.069
## BullyOth3_f|t2 1.547 0.023 67.623 0.000 1.547 1.547
## BullyOth3_f|t3 1.792 0.027 66.315 0.000 1.792 1.792
## BullyOth3_f|t4 2.075 0.034 61.100 0.000 2.075 2.075
## BullyOth4_f|t1 1.183 0.019 62.935 0.000 1.183 1.183
## BullyOth4_f|t2 1.681 0.025 67.322 0.000 1.681 1.681
## BullyOth4_f|t3 1.888 0.029 64.941 0.000 1.888 1.888
## BullyOth4_f|t4 2.177 0.037 58.457 0.000 2.177 2.177
## BullyOth5_f|t1 1.346 0.020 66.061 0.000 1.346 1.346
## BullyOth5_f|t2 1.725 0.026 67.002 0.000 1.725 1.725
## BullyOth5_f|t3 1.910 0.030 64.560 0.000 1.910 1.910
## BullyOth5_f|t4 2.142 0.036 59.383 0.000 2.142 2.142
## BullyOth6_f|t1 1.538 0.023 67.604 0.000 1.538 1.538
## BullyOth6_f|t2 1.802 0.027 66.192 0.000 1.802 1.802
## BullyOth6_f|t3 2.028 0.033 62.186 0.000 2.028 2.028
## BullyOth6_f|t4 2.289 0.041 55.187 0.000 2.289 2.289
## BullyOth7_f|t1 1.120 0.018 61.269 0.000 1.120 1.120
## BullyOth7_f|t2 1.563 0.023 67.641 0.000 1.563 1.563
## BullyOth7_f|t3 1.811 0.027 66.084 0.000 1.811 1.811
## BullyOth7_f|t4 2.041 0.033 61.885 0.000 2.041 2.041
## BullyOth8_f|t1 1.505 0.022 67.498 0.000 1.505 1.505
## BullyOth8_f|t2 1.832 0.028 65.802 0.000 1.832 1.832
## BullyOth8_f|t3 2.058 0.033 61.504 0.000 2.058 2.058
## BullyOth8_f|t4 2.313 0.042 54.465 0.000 2.313 2.313
## BullyOth9_f|t1 1.542 0.023 67.613 0.000 1.542 1.542
## BullyOth9_f|t2 1.859 0.028 65.402 0.000 1.859 1.859
## BullyOth9_f|t3 2.039 0.033 61.946 0.000 2.039 2.039
## BullyOth9_f|t4 2.254 0.040 56.243 0.000 2.254 2.254
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## bullyOther 1.000 1.000 1.000
## .BullyOth1_f 0.448 0.448 0.448
## .BullyOth2_f 0.395 0.395 0.395
## .BullyOth3_f 0.291 0.291 0.291
## .BullyOth4_f 0.265 0.265 0.265
## .BullyOth5_f 0.200 0.200 0.200
## .BullyOth6_f 0.120 0.120 0.120
## .BullyOth7_f 0.302 0.302 0.302
## .BullyOth8_f 0.165 0.165 0.165
## .BullyOth9_f 0.140 0.140 0.140
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## BullyOth1_f 1.000 1.000 1.000
## BullyOth2_f 1.000 1.000 1.000
## BullyOth3_f 1.000 1.000 1.000
## BullyOth4_f 1.000 1.000 1.000
## BullyOth5_f 1.000 1.000 1.000
## BullyOth6_f 1.000 1.000 1.000
## BullyOth7_f 1.000 1.000 1.000
## BullyOth8_f 1.000 1.000 1.000
## BullyOth9_f 1.000 1.000 1.000
#### One-Factor CFA for Got Bullied Items
#### A Nine-Item Five-Point Likert Scale
#### ("GotBully1_f" Coded as Factor Variable)
#### ("GotBully1_i" Coded as Integer Varable)
if(interactive()) peek(hbsc[ , c("GotBully1_f", "GotBully1_i", "GotBully2_f", "GotBully2_i",
"GotBully3_f", "GotBully3_i", "GotBully4_f", "GotBully4_i",
"GotBully5_f", "GotBully5_i", "GotBully6_f", "GotBully6_i",
"GotBully7_f", "GotBully7_i", "GotBully8_f", "GotBully8_i",
"GotBully9_f", "GotBully9_i")])
## Continuous Treatment of the Items (ML)
model.gotBully.integer <- '
gotBully =~ NA*GotBully1_i + GotBully2_i + GotBully3_i
+ GotBully4_i + GotBully5_i + GotBully6_i
+ GotBully7_i + GotBully8_i + GotBully9_i
gotBully ~~ 1*gotBully
'
fit.gotBully.ML.integer <- cfa(model = model.gotBully.integer, data = hbsc,
mimic = "Mplus", estimator = "ML")
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be ignored:
## 10 15 28 34 43 47 48 71 72 73 80 81 84 89 90 93 103 131 137 142 148 150 151 163 168 169 177 178 184 190 195 226 232 235 242 247 251 252 253 256 259 260 272 280 287 292 297 323 328 333 356 360 366 373 375 376 381 382 385 396 398 400 402 403 410 412 417 418 420 426 434 439 447 449 450 452 461 466 474 477 486 489 490 507 508 526 530 541 542 548 550 553 554 557 563 578 579 582 591 593 594 595 603 608 613 616 622 628 636 639 649 652 654 655 660 664 666 670 674 679 684 686 688 690 695 726 727 728 729 730 732 746 751 753 760 766 771 781 785 799 813 821 831 836 853 868 872 883 891 892 896 897 901 904 911 912 919 920 934 942 946 952 953 969 971 972 977 1000 1013 1015 1017 1023 1025 1043 1045 1048 1049 1052 1055 1056 1062 1063 1068 1072 1073 1076 1091 1092 1101 1109 1111 1120 1123 1125 1132 1140 1144 1150 1156 1158 1160 1166 1171 1173 1179 1188 1190 1193 1196 1203 1204 1206 1213 1214 1216 1235 1247 1262 1272 1273 1285 1288 1302 1306 1314 1320 1330 1332 1350 1352 1353 1354 1360 1363 1369 1377 1382 1385 1387 1390 1391 1396 1398 1404 1419 1438 1441 1442 1447 1450 1454 1479 1484 1487 1498 1508 1509 1512 1515 1516 1519 1521 1526 1527 1530 1534 1536 1537 1538 1539 1542 1553 1555 1558 1559 1560 1568 1569 1573 1577 1588 1594 1601 1618 1623 1625 1628 1648 1656 1666 1670 1672 1681 1683 1688 1691 1693 1694 1695 1700 1708 1710 1712 1715 1717 1718 1730 1735 1739 1740 1741 1742 1747 1751 1752 1761 1772 1774 1787 1789 1790 1794 1798 1799 1805 1809 1813 1820 1832 1838 1843 1857 1864 1875 1879 1882 1890 1897 1902 1903 1914 1920 1921 1922 1927 1929 1945 1951 1953 1962 1963 1966 1967 1969 1971 1984 1988 1990 1997 1998 2003 2007 2009 2012 2014 2034 2040 2048 2059 2108 2117 2125 2129 2137 2154 2156 2159 2167 2175 2176 2178 2186 2194 2202 2203 2217 2221 2223 2234 2242 2249 2264 2268 2282 2308 2309 2319 2325 2338 2357 2360 2363 2364 2374 2380 2386 2387 2391 2397 2422 2436 2440 2444 2445 2447 2450 2454 2473 2478 2491 2496 2505 2518 2521 2523 2524 2529 2544 2553 2556 2557 2563 2571 2587 2591 2601 2603 2606 2609 2623 2627 2636 2637 2645 2649 2660 2665 2672 2676 2695 2700 2703 2708 2713 2716 2723 2736 2739 2744 2753 2764 2778 2782 2783 2784 2788 2793 2794 2799 2805 2807 2808 2812 2826 2829 2834 2838 2839 2874 2887 2897 2898 2900 2908 2913 2932 2940 2949 2950 2960 2961 2976 2982 2988 2990 2992 2995 3003 3007 3032 3036 3038 3041 3044 3046 3049 3056 3061 3070 3079 3083 3090 3092 3098 3103 3108 3110 3112 3134 3143 3149 3155 3158 3160 3164 3168 3170 3180 3182 3184 3190 3192 3198 3202 3209 3210 3214 3215 3216 3225 3234 3237 3240 3245 3251 3256 3257 3262 3276 3280 3289 3292 3301 3305 3306 3316 3317 3333 3342 3345 3363 3378 3398 3399 3405 3408 3410 3413 3419 3423 3428 3432 3433 3439 3449 3457 3467 3480 3485 3486 3493 3494 3496 3505 3508 3513 3516 3518 3522 3524 3539 3540 3542 3550 3551 3554 3566 3567 3568 3570 3580 3590 3594 3597 3600 3614 3616 3618 3619 3620 3625 3627 3637 3638 3645 3649 3662 3671 3673 3685 3687 3690 3700 3705 3708 3711 3719 3720 3725 3731 3736 3745 3747 3748 3757 3758 3764 3765 3775 3776 3781 3782 3787 3793 3795 3796 3797 3800 3802 3809 3817 3818 3831 3839 3860 3864 3870 3886 3889 3897 3902 3906 3908 3909 3914 3923 3949 3958 3961 3968 3974 3975 3979 3987 3991 3999 4001 4012 4017 4038 4043 4061 4065 4070 4080 4087 4092 4093 4098 4101 4104 4115 4122 4125 4127 4133 4137 4141 4148 4152 4155 4157 4161 4163 4164 4167 4179 4183 4201 4205 4209 4231 4238 4244 4248 4257 4262 4268 4282 4286 4288 4291 4292 4294 4303 4307 4319 4339 4343 4344 4347 4355 4356 4357 4361 4363 4378 4388 4393 4408 4412 4413 4415 4420 4421 4457 4458 4463 4469 4470 4471 4472 4477 4478 4480 4489 4491 4492 4494 4496 4501 4506 4516 4526 4535 4536 4538 4541 4542 4552 4565 4566 4574 4576 4580 4586 4593 4610 4614 4624 4630 4638 4644 4648 4654 4657 4658 4661 4667 4670 4671 4687 4692 4695 4699 4719 4720 4723 4732 4736 4751 4759 4762 4770 4783 4788 4789 4791 4793 4794 4804 4807 4810 4818 4820 4826 4828 4833 4838 4865 4868 4888 4901 4917 4920 4939 4943 4956 4965 4966 4973 4977 4998 5016 5028 5033 5034 5062 5068 5075 5080 5092 5093 5110 5111 5122 5132 5136 5140 5144 5153 5166 5169 5170 5176 5178 5181 5185 5187 5190 5199 5204 5212 5217 5232 5240 5241 5249 5259 5267 5274 5275 5276 5279 5291 5293 5303 5305 5327 5336 5367 5368 5378 5384 5385 5386 5392 5397 5423 5440 5445 5459 5463 5470 5474 5496 5508 5511 5513 5527 5537 5538 5543 5550 5552 5553 5555 5556 5570 5575 5576 5577 5593 5599 5600 5601 5603 5615 5620 5632 5639 5641 5658 5679 5682 5699 5709 5728 5733 5737 5753 5766 5772 5781 5785 5791 5801 5813 5816 5817 5825 5827 5837 5846 5847 5856 5861 5872 5874 5909 5918 5924 5928 5938 5941 5942 5956 5959 5969 5982 5983 5986 5994 6003 6005 6022 6024 6031 6033 6037 6038 6039 6047 6053 6061 6068 6087 6088 6089 6102 6105 6117 6123 6133 6141 6170 6183 6184 6186 6205 6206 6210 6215 6216 6217 6220 6239 6249 6263 6275 6280 6282 6286 6291 6293 6294 6307 6310 6313 6316 6319 6328 6329 6337 6345 6348 6356 6361 6366 6372 6375 6376 6412 6421 6426 6434 6439 6442 6445 6446 6452 6454 6457 6460 6465 6466 6467 6471 6473 6477 6488 6492 6499 6501 6515 6521 6524 6526 6545 6550 6551 6556 6559 6564 6595 6599 6619 6624 6631 6633 6640 6643 6644 6646 6666 6673 6676 6679 6681 6686 6688 6689 6693 6695 6707 6719 6726 6739 6746 6749 6753 6782 6785 6788 6795 6796 6800 6801 6804 6816 6817 6827 6834 6835 6852 6859 6869 6884 6885 6889 6891 6896 6903 6909 6911 6917 6924 6933 6941 6942 6943 6950 6968 6971 6972 6976 6979 6987 6991 6996 6999 7002 7023 7027 7032 7036 7049 7064 7074 7081 7085 7088 7092 7099 7101 7112 7114 7122 7136 7142 7143 7148 7159 7162 7165 7173 7185 7186 7188 7220 7228 7234 7239 7254 7255 7259 7262 7265 7266 7271 7280 7288 7294 7298 7301 7311 7312 7332 7344 7347 7348 7351 7352 7353 7355 7358 7361 7381 7386 7398 7406 7418 7420 7422 7438 7459 7461 7470 7471 7472 7479 7482 7484 7488 7489 7505 7514 7517 7518 7520 7525 7527 7530 7535 7542 7547 7553 7559 7567 7571 7576 7577 7582 7607 7610 7612 7633 7641 7644 7648 7655 7662 7663 7667 7687 7688 7691 7692 7708 7709 7717 7720 7721 7724 7731 7738 7742 7751 7761 7767 7776 7780 7787 7788 7792 7794 7798 7825 7840 7841 7858 7862 7867 7879 7884 7904 7910 7921 7926 7931 7932 7943 7952 7959 7962 7969 7992 7996 7999 8003 8007 8012 8024 8031 8032 8034 8035 8041 8042 8043 8052 8064 8074 8078 8080 8089 8098 8108 8113 8115 8117 8119 8125 8127 8138 8150 8153 8155 8159 8161 8171 8175 8181 8184 8185 8190 8195 8198 8203 8209 8211 8222 8227 8231 8235 8238 8241 8242 8250 8269 8273 8275 8276 8281 8283 8291 8292 8296 8299 8300 8301 8304 8305 8307 8310 8316 8317 8319 8323 8340 8341 8345 8348 8358 8364 8388 8389 8396 8414 8415 8416 8421 8438 8443 8457 8458 8466 8472 8485 8493 8497 8506 8507 8518 8520 8526 8534 8538 8541 8545 8553 8561 8570 8578 8584 8586 8598 8603 8607 8618 8622 8626 8640 8641 8643 8646 8647 8648 8652 8664 8669 8670 8672 8676 8679 8684 8685 8686 8689 8698 8699 8703 8716 8724 8740 8747 8764 8772 8789 8793 8799 8808 8811 8816 8823 8827 8833 8837 8850 8852 8864 8876 8887 8915 8919 8930 8933 8935 8937 8941 8944 8952 8953 8981 8982 8990 8996 9000 9018 9023 9026 9028 9033 9039 9040 9041 9049 9059 9061 9072 9078 9082 9090 9101 9114 9124 9132 9135 9141 9144 9155 9156 9157 9159 9165 9166 9169 9171 9173 9174 9177 9180 9192 9201 9203 9208 9209 9211 9218 9220
summary(fit.gotBully.ML.integer, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 29 iterations
##
## Used Total
## Number of observations 7747 9227
##
## Number of missing patterns 43
##
## Estimator ML
## Minimum Function Test Statistic 4264.678
## Degrees of freedom 27
## P-value (Chi-square) 0.000
##
## Model test baseline model:
##
## Minimum Function Test Statistic 27845.225
## Degrees of freedom 36
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.848
## Tucker-Lewis Index (TLI) 0.797
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -75132.615
## Loglikelihood unrestricted model (H1) -73000.276
##
## Number of free parameters 27
## Akaike (AIC) 150319.231
## Bayesian (BIC) 150507.018
## Sample-size adjusted Bayesian (BIC) 150421.217
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.142
## 90 Percent Confidence Interval 0.139 0.146
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.064
##
## Parameter Estimates:
##
## Information Observed
## Standard Errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## gotBully =~
## GotBully1_i 0.741 0.013 58.391 0.000 0.741 0.638
## GotBully2_i 0.654 0.011 58.345 0.000 0.654 0.637
## GotBully3_i 0.566 0.009 65.525 0.000 0.566 0.692
## GotBully4_i 0.712 0.012 61.765 0.000 0.712 0.665
## GotBully5_i 0.568 0.009 64.812 0.000 0.568 0.689
## GotBully6_i 0.478 0.007 65.043 0.000 0.478 0.695
## GotBully7_i 0.658 0.012 56.773 0.000 0.658 0.622
## GotBully8_i 0.414 0.007 60.495 0.000 0.414 0.662
## GotBully9_i 0.379 0.006 58.455 0.000 0.379 0.645
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .GotBully1_i 0.664 0.013 50.264 0.000 0.664 0.571
## .GotBully2_i 0.514 0.012 43.964 0.000 0.514 0.500
## .GotBully3_i 0.284 0.009 30.479 0.000 0.284 0.347
## .GotBully4_i 0.613 0.012 50.314 0.000 0.613 0.572
## .GotBully5_i 0.281 0.009 29.876 0.000 0.281 0.340
## .GotBully6_i 0.192 0.008 24.503 0.000 0.192 0.279
## .GotBully7_i 0.516 0.012 42.769 0.000 0.516 0.487
## .GotBully8_i 0.162 0.007 22.784 0.000 0.162 0.260
## .GotBully9_i 0.133 0.007 19.857 0.000 0.133 0.226
## gotBully 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## gotBully 1.000 1.000 1.000
## .GotBully1_i 0.800 0.015 54.658 0.000 0.800 0.593
## .GotBully2_i 0.626 0.011 55.048 0.000 0.626 0.594
## .GotBully3_i 0.348 0.006 53.680 0.000 0.348 0.521
## .GotBully4_i 0.640 0.012 53.999 0.000 0.640 0.558
## .GotBully5_i 0.358 0.007 53.441 0.000 0.358 0.526
## .GotBully6_i 0.245 0.005 52.418 0.000 0.245 0.517
## .GotBully7_i 0.688 0.012 56.074 0.000 0.688 0.614
## .GotBully8_i 0.220 0.004 53.579 0.000 0.220 0.562
## .GotBully9_i 0.201 0.004 54.156 0.000 0.201 0.584
## Categorical Treatment of the Items (WLSMV)
model.gotBully.factor <- '
gotBully =~ NA*GotBully1_f + GotBully2_f + GotBully3_f
+ GotBully4_f + GotBully5_f + GotBully6_f
+ GotBully7_f + GotBully8_f + GotBully9_f
gotBully ~~ 1*gotBully
'
fit.gotBully.WLSMV.factor <-
cfa(model = model.gotBully.factor, data = hbsc,
mimic = "Mplus", estimator = "WLSMV",
ordered = c("GotBully1_f", "GotBully2_f",
"GotBully3_f", "GotBully4_f",
"GotBully5_f", "GotBully6_f",
"GotBully7_f", "GotBully8_f",
"GotBully9_f"))
summary(fit.gotBully.WLSMV.factor, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 14 iterations
##
## Used Total
## Number of observations 7526 9227
##
## Estimator DWLS Robust
## Minimum Function Test Statistic 728.460 1214.776
## Degrees of freedom 27 27
## P-value (Chi-square) 0.000 0.000
## Scaling correction factor 0.601
## Shift parameter 3.567
## for simple second-order correction (WLSMV)
##
## Model test baseline model:
##
## Minimum Function Test Statistic 79174.972 38684.865
## Degrees of freedom 36 36
## P-value 0.000 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.991 0.969
## Tucker-Lewis Index (TLI) 0.988 0.959
##
## Robust Comparative Fit Index (CFI) NA
## Robust Tucker-Lewis Index (TLI) NA
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.059 0.076
## 90 Percent Confidence Interval 0.055 0.062 0.073 0.080
## P-value RMSEA <= 0.05 0.000 0.000
##
## Robust RMSEA NA
## 90 Percent Confidence Interval NA NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.054 0.054
##
## Weighted Root Mean Square Residual:
##
## WRMR 3.181 3.181
##
## Parameter Estimates:
##
## Information Expected
## Standard Errors Robust.sem
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## gotBully =~
## GotBully1_f 0.777 0.008 93.907 0.000 0.777 0.777
## GotBully2_f 0.771 0.008 91.170 0.000 0.771 0.771
## GotBully3_f 0.803 0.009 89.447 0.000 0.803 0.803
## GotBully4_f 0.782 0.008 101.800 0.000 0.782 0.782
## GotBully5_f 0.815 0.009 94.006 0.000 0.815 0.815
## GotBully6_f 0.846 0.009 91.692 0.000 0.846 0.846
## GotBully7_f 0.747 0.009 81.022 0.000 0.747 0.747
## GotBully8_f 0.861 0.009 100.022 0.000 0.861 0.861
## GotBully9_f 0.889 0.009 94.807 0.000 0.889 0.889
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .GotBully1_f 0.000 0.000 0.000
## .GotBully2_f 0.000 0.000 0.000
## .GotBully3_f 0.000 0.000 0.000
## .GotBully4_f 0.000 0.000 0.000
## .GotBully5_f 0.000 0.000 0.000
## .GotBully6_f 0.000 0.000 0.000
## .GotBully7_f 0.000 0.000 0.000
## .GotBully8_f 0.000 0.000 0.000
## .GotBully9_f 0.000 0.000 0.000
## gotBully 0.000 0.000 0.000
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## GotBully1_f|t1 0.431 0.015 28.857 0.000 0.431 0.431
## GotBully1_f|t2 1.043 0.018 58.914 0.000 1.043 1.043
## GotBully1_f|t3 1.254 0.019 64.520 0.000 1.254 1.254
## GotBully1_f|t4 1.520 0.022 67.572 0.000 1.520 1.520
## GotBully2_f|t1 0.618 0.015 39.860 0.000 0.618 0.618
## GotBully2_f|t2 1.193 0.019 63.170 0.000 1.193 1.193
## GotBully2_f|t3 1.421 0.021 66.944 0.000 1.421 1.421
## GotBully2_f|t4 1.733 0.026 66.954 0.000 1.733 1.733
## GotBully3_f|t1 1.082 0.018 60.180 0.000 1.082 1.082
## GotBully3_f|t2 1.512 0.022 67.546 0.000 1.512 1.512
## GotBully3_f|t3 1.727 0.026 67.005 0.000 1.727 1.727
## GotBully3_f|t4 1.976 0.031 63.314 0.000 1.976 1.976
## GotBully4_f|t1 0.424 0.015 28.379 0.000 0.424 0.424
## GotBully4_f|t2 1.103 0.018 60.796 0.000 1.103 1.103
## GotBully4_f|t3 1.385 0.021 66.570 0.000 1.385 1.385
## GotBully4_f|t4 1.654 0.025 67.481 0.000 1.654 1.654
## GotBully5_f|t1 1.108 0.018 60.939 0.000 1.108 1.108
## GotBully5_f|t2 1.510 0.022 67.538 0.000 1.510 1.510
## GotBully5_f|t3 1.709 0.025 67.147 0.000 1.709 1.709
## GotBully5_f|t4 1.965 0.031 63.549 0.000 1.965 1.965
## GotBully6_f|t1 1.339 0.020 65.965 0.000 1.339 1.339
## GotBully6_f|t2 1.691 0.025 67.277 0.000 1.691 1.691
## GotBully6_f|t3 1.894 0.029 64.854 0.000 1.894 1.894
## GotBully6_f|t4 2.136 0.036 59.567 0.000 2.136 2.136
## GotBully7_f|t1 0.671 0.016 42.729 0.000 0.671 0.671
## GotBully7_f|t2 1.148 0.019 62.058 0.000 1.148 1.148
## GotBully7_f|t3 1.395 0.021 66.689 0.000 1.395 1.395
## GotBully7_f|t4 1.685 0.025 67.313 0.000 1.685 1.685
## GotBully8_f|t1 1.398 0.021 66.718 0.000 1.398 1.398
## GotBully8_f|t2 1.787 0.027 66.388 0.000 1.787 1.787
## GotBully8_f|t3 2.003 0.032 62.757 0.000 2.003 2.003
## GotBully8_f|t4 2.218 0.039 57.316 0.000 2.218 2.218
## GotBully9_f|t1 1.535 0.023 67.615 0.000 1.535 1.535
## GotBully9_f|t2 1.871 0.029 65.239 0.000 1.871 1.871
## GotBully9_f|t3 2.044 0.033 61.835 0.000 2.044 2.044
## GotBully9_f|t4 2.230 0.039 56.974 0.000 2.230 2.230
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## gotBully 1.000 1.000 1.000
## .GotBully1_f 0.397 0.397 0.397
## .GotBully2_f 0.406 0.406 0.406
## .GotBully3_f 0.356 0.356 0.356
## .GotBully4_f 0.388 0.388 0.388
## .GotBully5_f 0.335 0.335 0.335
## .GotBully6_f 0.284 0.284 0.284
## .GotBully7_f 0.442 0.442 0.442
## .GotBully8_f 0.258 0.258 0.258
## .GotBully9_f 0.210 0.210 0.210
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## GotBully1_f 1.000 1.000 1.000
## GotBully2_f 1.000 1.000 1.000
## GotBully3_f 1.000 1.000 1.000
## GotBully4_f 1.000 1.000 1.000
## GotBully5_f 1.000 1.000 1.000
## GotBully6_f 1.000 1.000 1.000
## GotBully7_f 1.000 1.000 1.000
## GotBully8_f 1.000 1.000 1.000
## GotBully9_f 1.000 1.000 1.000
#### One-Factor CFA for Body Feelings items
#### A Five-Item Five-Point Likert Scale
#### ("BodyFeelings1_f" Coded as Factor Variable)
#### ("BodyFeelings1_i" Coded as Integer Varable)
if(interactive()) peek(hbsc[ , c("BodyFeelings1_f", "BodyFeelings1_i",
"BodyFeelings2_f", "BodyFeelings2_i",
"BodyFeelings3_f", "BodyFeelings3_i",
"BodyFeelings4_f", "BodyFeelings4_i",
"BodyFeelings5_f", "BodyFeelings5_i")])
model.bodyFeelings.integer <- '
bodyFeelings =~ NA*BodyFeelings1_i + BodyFeelings2_i
+ BodyFeelings3_i + BodyFeelings4_i
+ BodyFeelings5_i
bodyFeelings ~~ 1*bodyFeelings'
## Continuous Treatment of the Items (ML)
fit.bodyFeelings.ML.integer <-
cfa(model = model.bodyFeelings.integer, data = hbsc,
mimic = "Mplus", estimator = "ML")
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be ignored:
## 4 5 17 20 21 22 29 30 54 61 67 70 71 73 78 90 102 115 117 123 124 125 131 147 156 161 175 183 184 186 192 209 217 225 227 231 240 241 249 263 272 281 285 301 306 313 320 327 342 344 358 364 369 372 377 382 387 401 406 411 416 424 431 432 435 441 445 448 466 468 473 477 481 492 510 536 540 551 560 566 569 589 599 605 614 626 627 628 631 632 645 647 651 658 659 662 673 679 683 694 716 725 744 752 754 758 761 771 780 782 784 794 802 805 809 830 839 841 846 853 884 886 887 891 892 911 914 918 930 934 962 968 970 976 979 987 989 990 992 993 1007 1020 1036 1039 1060 1073 1090 1096 1097 1117 1126 1128 1132 1140 1142 1147 1151 1159 1169 1174 1177 1179 1191 1200 1225 1228 1230 1232 1233 1239 1241 1243 1249 1266 1268 1269 1281 1289 1293 1320 1321 1333 1335 1360 1367 1372 1379 1386 1401 1404 1405 1417 1422 1425 1440 1445 1468 1481 1484 1492 1501 1516 1555 1569 1571 1581 1586 1595 1622 1634 1636 1639 1649 1654 1659 1670 1687 1690 1699 1705 1709 1717 1723 1724 1726 1730 1735 1736 1738 1739 1744 1745 1753 1754 1765 1768 1785 1789 1790 1791 1810 1819 1829 1833 1836 1837 1839 1845 1848 1853 1854 1863 1866 1882 1888 1890 1900 1901 1910 1913 1916 1917 1922 1923 1933 1959 1961 1965 1966 1972 1974 1980 1981 1982 1985 1987 1991 1998 2000 2017 2019 2028 2053 2054 2060 2063 2070 2077 2079 2089 2091 2097 2101 2107 2110 2116 2119 2123 2126 2128 2137 2141 2145 2147 2163 2166 2168 2182 2184 2189 2204 2214 2219 2224 2237 2239 2243 2245 2254 2274 2276 2278 2300 2314 2318 2324 2332 2338 2347 2353 2361 2375 2377 2378 2382 2384 2388 2390 2396 2397 2399 2403 2404 2407 2410 2411 2417 2418 2423 2429 2448 2457 2460 2471 2477 2483 2487 2497 2503 2504 2509 2516 2532 2537 2554 2555 2560 2563 2568 2574 2575 2585 2586 2590 2593 2598 2606 2607 2612 2617 2623 2627 2632 2636 2640 2653 2654 2658 2665 2689 2690 2693 2705 2717 2720 2728 2731 2734 2741 2743 2745 2746 2747 2756 2759 2765 2768 2769 2783 2789 2808 2822 2823 2824 2825 2828 2835 2837 2842 2849 2853 2855 2856 2860 2864 2865 2883 2887 2891 2892 2893 2895 2903 2904 2907 2917 2933 2935 2937 2956 2971 2980 2986 2991 2995 3001 3018 3022 3024 3025 3029 3032 3052 3064 3066 3084 3087 3088 3093 3098 3122 3135 3137 3148 3161 3164 3175 3177 3191 3194 3199 3200 3212 3213 3217 3219 3221 3222 3236 3244 3247 3261 3271 3274 3280 3290 3298 3311 3312 3314 3328 3333 3338 3341 3344 3365 3367 3368 3377 3385 3386 3390 3406 3410 3416 3423 3430 3440 3450 3457 3465 3477 3489 3501 3510 3515 3516 3521 3523 3527 3537 3545 3550 3556 3560 3563 3567 3569 3575 3577 3583 3585 3599 3606 3613 3624 3629 3631 3640 3650 3655 3692 3694 3703 3710 3716 3717 3718 3721 3749 3772 3782 3784 3789 3794 3799 3807 3814 3823 3827 3840 3845 3846 3848 3856 3857 3869 3873 3884 3887 3891 3895 3903 3915 3923 3925 3928 3934 3941 3950 3953 3957 3962 3976 3986 3993 4021 4023 4027 4046 4056 4057 4058 4059 4061 4069 4089 4092 4100 4112 4118 4122 4123 4141 4146 4148 4149 4154 4182 4187 4195 4202 4203 4209 4215 4221 4229 4233 4235 4250 4252 4253 4258 4268 4272 4281 4290 4295 4305 4309 4316 4320 4328 4335 4355 4360 4364 4377 4378 4380 4388 4397 4406 4415 4429 4430 4433 4436 4456 4459 4466 4475 4480 4486 4512 4523 4531 4550 4558 4564 4566 4584 4589 4601 4605 4616 4623 4626 4631 4653 4666 4670 4674 4690 4700 4708 4728 4742 4795 4815 4817 4832 4833 4852 4857 4863 4865 4866 4869 4871 4873 4879 4880 4884 4890 4895 4903 4905 4907 4908 4911 4914 4916 4925 4932 4933 4934 4941 4945 4949 4950 4965 4969 4972 4973 4974 4977 4993 4997 5000 5008 5010 5011 5012 5013 5014 5015 5020 5027 5051 5060 5071 5073 5077 5083 5085 5091 5093 5098 5101 5104 5106 5108 5114 5118 5146 5150 5154 5155 5156 5163 5167 5175 5178 5187 5205 5215 5219 5240 5241 5254 5258 5260 5266 5270 5276 5277 5285 5290 5297 5303 5304 5311 5317 5321 5323 5325 5330 5338 5341 5347 5353 5357 5379 5383 5388 5396 5402 5415 5421 5424 5427 5434 5435 5439 5446 5449 5450 5451 5466 5477 5484 5485 5493 5507 5508 5528 5533 5545 5551 5564 5567 5571 5573 5593 5594 5614 5618 5625 5638 5644 5657 5672 5673 5688 5700 5704 5708 5722 5725 5739 5748 5753 5754 5757 5768 5779 5786 5792 5794 5808 5814 5829 5830 5834 5844 5855 5860 5862 5871 5881 5884 5887 5888 5890 5893 5897 5902 5916 5918 5922 5929 5930 5941 5949 5953 5958 5963 5966 5970 5977 5979 5986 5999 6000 6002 6004 6028 6041 6043 6053 6055 6058 6064 6070 6071 6074 6077 6089 6093 6095 6103 6107 6112 6113 6122 6126 6127 6140 6145 6148 6153 6173 6181 6190 6201 6202 6207 6223 6228 6231 6241 6251 6256 6261 6270 6282 6285 6295 6305 6318 6323 6333 6346 6352 6359 6360 6364 6374 6396 6398 6422 6437 6456 6459 6462 6465 6473 6489 6492 6494 6501 6509 6517 6522 6546 6548 6552 6555 6560 6564 6565 6573 6585 6587 6599 6607 6612 6616 6617 6621 6628 6652 6653 6655 6663 6667 6692 6694 6696 6702 6706 6708 6717 6723 6743 6747 6749 6758 6764 6768 6775 6790 6793 6796 6803 6823 6826 6838 6841 6845 6860 6862 6872 6877 6879 6881 6886 6893 6900 6902 6905 6914 6931 6934 6964 6977 6986 6989 7009 7013 7017 7018 7020 7029 7032 7038 7045 7060 7068 7081 7082 7083 7084 7096 7097 7102 7107 7113 7114 7115 7125 7130 7134 7147 7162 7172 7177 7191 7200 7201 7204 7205 7208 7219 7223 7227 7231 7238 7240 7252 7256 7273 7276 7281 7293 7317 7327 7328 7335 7344 7346 7357 7374 7378 7384 7388 7390 7405 7411 7413 7416 7418 7423 7428 7431 7439 7442 7452 7453 7459 7460 7463 7469 7473 7490 7493 7500 7501 7504 7537 7540 7543 7561 7570 7585 7589 7590 7595 7599 7600 7606 7613 7631 7634 7639 7652 7667 7671 7673 7685 7704 7710 7712 7715 7717 7729 7732 7736 7739 7743 7748 7753 7754 7755 7769 7771 7779 7783 7795 7806 7821 7824 7829 7830 7831 7838 7848 7854 7882 7888 7889 7890 7891 7893 7903 7911 7919 7923 7928 7935 7939 7955 7956 7960 7973 7980 7984 7987 7991 7995 8005 8006 8011 8018 8021 8022 8026 8051 8053 8070 8076 8085 8096 8098 8109 8114 8117 8122 8129 8130 8132 8142 8145 8165 8178 8182 8183 8188 8191 8211 8212 8213 8216 8217 8221 8247 8256 8258 8285 8297 8314 8321 8327 8329 8343 8344 8345 8356 8357 8360 8378 8380 8394 8396 8417 8420 8427 8432 8435 8436 8441 8448 8449 8454 8468 8481 8496 8497 8502 8504 8508 8524 8527 8540 8542 8547 8555 8559 8566 8580 8581 8586 8587 8598 8607 8612 8617 8623 8637 8645 8650 8657 8664 8666 8700 8703 8704 8705 8716 8717 8718 8727 8733 8735 8736 8744 8746 8755 8757 8758 8759 8761 8767 8776 8777 8778 8779 8781 8784 8786 8789 8791 8797 8814 8816 8817 8831 8835 8857 8858 8862 8885 8889 8900 8907 8908 8910 8912 8920 8923 8929 8932 8943 8946 8947 8957 8959 8962 8972 8974 8977 8983 9004 9006 9009 9010 9012 9026 9029 9034 9036 9037 9041 9043 9049 9056 9059 9070 9076 9081 9083 9086 9088 9089 9096 9103 9121 9126 9127 9131 9132 9135 9159 9168 9189 9190 9193 9195 9197 9209 9214 9221
summary(fit.bodyFeelings.ML.integer, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 23 iterations
##
## Used Total
## Number of observations 7874 9227
##
## Number of missing patterns 23
##
## Estimator ML
## Minimum Function Test Statistic 1513.390
## Degrees of freedom 5
## P-value (Chi-square) 0.000
##
## Model test baseline model:
##
## Minimum Function Test Statistic 18808.555
## Degrees of freedom 10
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.920
## Tucker-Lewis Index (TLI) 0.840
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -55457.378
## Loglikelihood unrestricted model (H1) -54700.683
##
## Number of free parameters 15
## Akaike (AIC) 110944.755
## Bayesian (BIC) 111049.325
## Sample-size adjusted Bayesian (BIC) 111001.658
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.196
## 90 Percent Confidence Interval 0.188 0.204
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.044
##
## Parameter Estimates:
##
## Information Observed
## Standard Errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## bodyFeelings =~
## BodyFeelings1_ 1.013 0.014 74.387 0.000 1.013 0.758
## BodyFeelings2_ -0.897 0.013 -69.646 0.000 -0.897 -0.732
## BodyFeelings3_ 0.993 0.012 81.238 0.000 0.993 0.814
## BodyFeelings4_ -0.942 0.013 -70.514 0.000 -0.942 -0.732
## BodyFeelings5_ 0.866 0.012 71.391 0.000 0.866 0.743
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .BodyFeelings1_ 1.479 0.015 98.125 0.000 1.479 1.107
## .BodyFeelings2_ 2.486 0.014 179.675 0.000 2.486 2.029
## .BodyFeelings3_ 0.870 0.014 63.137 0.000 0.870 0.713
## .BodyFeelings4_ 2.612 0.015 179.719 0.000 2.612 2.029
## .BodyFeelings5_ 0.764 0.013 58.035 0.000 0.764 0.655
## bodyFeelings 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## bodyFeelings 1.000 1.000 1.000
## .BodyFeelings1_ 0.759 0.016 48.758 0.000 0.759 0.425
## .BodyFeelings2_ 0.697 0.014 48.598 0.000 0.697 0.464
## .BodyFeelings3_ 0.503 0.012 40.668 0.000 0.503 0.338
## .BodyFeelings4_ 0.769 0.015 50.248 0.000 0.769 0.464
## .BodyFeelings5_ 0.609 0.013 48.272 0.000 0.609 0.448
## Categorical Treatment of the Items (WLSMV)
model.bodyFeelings.factor <- '
bodyFeelings =~ NA*BodyFeelings1_f + BodyFeelings2_f
+ BodyFeelings3_f + BodyFeelings4_f
+ BodyFeelings5_f
bodyFeelings ~~ 1*bodyFeelings
'
fit.bodyFeelings.WLSMV.factor <-
cfa(model = model.bodyFeelings.factor, data = hbsc,
mimic = "Mplus", estimator = "WLSMV",
ordered = c("BodyFeelings1_f", "BodyFeelings2_f",
"BodyFeelings3_f", "BodyFeelings4_f",
"BodyFeelings5_f"))
summary(fit.bodyFeelings.WLSMV.factor, fit.measures = TRUE,
standardized = TRUE)
## lavaan (0.5-22) converged normally after 18 iterations
##
## Used Total
## Number of observations 7723 9227
##
## Estimator DWLS Robust
## Minimum Function Test Statistic 731.399 1663.755
## Degrees of freedom 5 5
## P-value (Chi-square) 0.000 0.000
## Scaling correction factor 0.440
## Shift parameter 0.678
## for simple second-order correction (WLSMV)
##
## Model test baseline model:
##
## Minimum Function Test Statistic 110919.008 62733.876
## Degrees of freedom 10 10
## P-value 0.000 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.993 0.974
## Tucker-Lewis Index (TLI) 0.987 0.947
##
## Robust Comparative Fit Index (CFI) NA
## Robust Tucker-Lewis Index (TLI) NA
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.137 0.207
## 90 Percent Confidence Interval 0.129 0.146 0.199 0.216
## P-value RMSEA <= 0.05 0.000 0.000
##
## Robust RMSEA NA
## 90 Percent Confidence Interval NA NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.042 0.042
##
## Weighted Root Mean Square Residual:
##
## WRMR 4.938 4.938
##
## Parameter Estimates:
##
## Information Expected
## Standard Errors Robust.sem
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## bodyFeelings =~
## BodyFeelngs1_f 0.809 0.005 176.752 0.000 0.809 0.809
## BodyFeelngs2_f -0.816 0.005 -178.624 0.000 -0.816 -0.816
## BodyFeelngs3_f 0.888 0.004 230.053 0.000 0.888 0.888
## BodyFeelngs4_f -0.800 0.005 -164.600 0.000 -0.800 -0.800
## BodyFeelngs5_f 0.839 0.005 166.781 0.000 0.839 0.839
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .BodyFeelngs1_f 0.000 0.000 0.000
## .BodyFeelngs2_f 0.000 0.000 0.000
## .BodyFeelngs3_f 0.000 0.000 0.000
## .BodyFeelngs4_f 0.000 0.000 0.000
## .BodyFeelngs5_f 0.000 0.000 0.000
## bodyFeelings 0.000 0.000 0.000
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## BdyFlngs1_f|t1 -0.471 0.015 -31.740 0.000 -0.471 -0.471
## BdyFlngs1_f|t2 0.137 0.014 9.589 0.000 0.137 0.137
## BdyFlngs1_f|t3 0.664 0.015 42.924 0.000 0.664 0.664
## BdyFlngs1_f|t4 1.302 0.020 66.241 0.000 1.302 1.302
## BdyFlngs2_f|t1 -1.375 0.020 -67.318 0.000 -1.375 -1.375
## BdyFlngs2_f|t2 -0.740 0.016 -46.896 0.000 -0.740 -0.740
## BdyFlngs2_f|t3 -0.190 0.014 -13.248 0.000 -0.190 -0.190
## BdyFlngs2_f|t4 0.749 0.016 47.369 0.000 0.749 0.749
## BdyFlngs3_f|t1 0.162 0.014 11.294 0.000 0.162 0.162
## BdyFlngs3_f|t2 0.722 0.016 46.012 0.000 0.722 0.722
## BdyFlngs3_f|t3 1.124 0.018 62.193 0.000 1.124 1.124
## BdyFlngs3_f|t4 1.541 0.022 68.509 0.000 1.541 1.541
## BdyFlngs4_f|t1 -1.296 0.020 -66.137 0.000 -1.296 -1.296
## BdyFlngs4_f|t2 -0.799 0.016 -49.800 0.000 -0.799 -0.799
## BdyFlngs4_f|t3 -0.317 0.015 -21.844 0.000 -0.317 -0.317
## BdyFlngs4_f|t4 0.525 0.015 35.006 0.000 0.525 0.525
## BdyFlngs5_f|t1 0.291 0.014 20.078 0.000 0.291 0.291
## BdyFlngs5_f|t2 0.784 0.016 49.079 0.000 0.784 0.784
## BdyFlngs5_f|t3 1.246 0.019 65.181 0.000 1.246 1.246
## BdyFlngs5_f|t4 1.628 0.024 68.461 0.000 1.628 1.628
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## bodyFeelings 1.000 1.000 1.000
## .BodyFeelngs1_f 0.345 0.345 0.345
## .BodyFeelngs2_f 0.334 0.334 0.334
## .BodyFeelngs3_f 0.212 0.212 0.212
## .BodyFeelngs4_f 0.360 0.360 0.360
## .BodyFeelngs5_f 0.297 0.297 0.297
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## BodyFeelngs1_f 1.000 1.000 1.000
## BodyFeelngs2_f 1.000 1.000 1.000
## BodyFeelngs3_f 1.000 1.000 1.000
## BodyFeelngs4_f 1.000 1.000 1.000
## BodyFeelngs5_f 1.000 1.000 1.000
#### One-Factor CFA for Physical Health Items
#### An Eight-Item Five-Point Likert Scale
#### ("PhysHealth1_f" Coded as Factor Variable)
#### ("PhysHealth1_i" Coded as Integer Varable)
if(interactive()) peek(hbsc[ , c("PhysHealth1_f", "PhysHealth1_i", "PhysHealth2_f", "PhysHealth2_i",
"PhysHealth3_f", "PhysHealth3_i", "PhysHealth4_f", "PhysHealth4_i",
"PhysHealth5_f", "PhysHealth5_i", "PhysHealth6_f", "PhysHealth6_i",
"PhysHealth7_f", "PhysHealth7_i", "PhysHealth8_f", "PhysHealth8_i")])
## Continuous Treatment of the Items (ML)
model.physHealth.integer <- '
physHealth =~ NA*PhysHealth1_i + PhysHealth2_i
+ PhysHealth3_i + PhysHealth4_i
+ PhysHealth5_i + PhysHealth6_i
+ PhysHealth7_i + PhysHealth8_i
physHealth ~~ 1*physHealth'
fit.physHealth.ML.integer <-
cfa(model = model.physHealth.integer, data = hbsc,
mimic = "Mplus", estimator = "ML")
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be ignored:
## 73 90 184 247 382 466 477 628 660 679 771 892 934 988 1015 1055 1073 1117 1179 1360 1404 1447 1501 1571 1670 1709 1717 1735 1739 1763 1789 1790 1882 1922 1966 1998 2137 2168 2375 2397 2555 2563 2606 2623 2627 2636 2665 2983 2995 3032 3098 3213 3261 3271 3333 3410 3423 3457 3550 3567 3568 3646 3782 3870 4092 4122 4141 4148 4268 4320 4388 4415 4480 4833 4865 4925 4933 4973 4977 5093 5101 5276 5303 5753 5941 6053 6055 6089 6181 6473 6501 6564 6599 6708 6796 7032 7114 7332 7344 7357 7386 7531 7667 7935 8034 8117 8233 8386 8432 8443 8491 8598 8607 8664 8789 8816 8850 9041 9049 9132 9135 9159 9165 9182
summary(fit.physHealth.ML.integer, fit.measures = TRUE,
standardized = TRUE)
## lavaan (0.5-22) converged normally after 30 iterations
##
## Used Total
## Number of observations 9103 9227
##
## Number of missing patterns 60
##
## Estimator ML
## Minimum Function Test Statistic 601.015
## Degrees of freedom 20
## P-value (Chi-square) 0.000
##
## Model test baseline model:
##
## Minimum Function Test Statistic 16363.895
## Degrees of freedom 28
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.964
## Tucker-Lewis Index (TLI) 0.950
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -115169.781
## Loglikelihood unrestricted model (H1) -114869.273
##
## Number of free parameters 24
## Akaike (AIC) 230387.561
## Bayesian (BIC) 230558.354
## Sample-size adjusted Bayesian (BIC) 230482.086
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.056
## 90 Percent Confidence Interval 0.053 0.060
## P-value RMSEA <= 0.05 0.003
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.026
##
## Parameter Estimates:
##
## Information Observed
## Standard Errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## physHealth =~
## PhysHealth1_i 0.781 0.014 56.361 0.000 0.781 0.597
## PhysHealth2_i 0.709 0.012 57.953 0.000 0.709 0.611
## PhysHealth3_i 0.688 0.014 47.516 0.000 0.688 0.517
## PhysHealth4_i 0.871 0.014 63.816 0.000 0.871 0.661
## PhysHealth5_i 0.808 0.015 53.115 0.000 0.808 0.569
## PhysHealth6_i 0.738 0.015 50.161 0.000 0.738 0.542
## PhysHealth7_i 0.877 0.016 53.243 0.000 0.877 0.570
## PhysHealth8_i 0.755 0.013 59.702 0.000 0.755 0.625
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .PhysHealth1_i 2.827 0.014 206.103 0.000 2.827 2.162
## .PhysHealth2_i 3.003 0.012 246.309 0.000 3.003 2.586
## .PhysHealth3_i 3.001 0.014 214.424 0.000 3.001 2.254
## .PhysHealth4_i 3.017 0.014 217.537 0.000 3.017 2.289
## .PhysHealth5_i 2.510 0.015 168.100 0.000 2.510 1.767
## .PhysHealth6_i 2.629 0.014 183.283 0.000 2.629 1.928
## .PhysHealth7_i 2.646 0.016 163.482 0.000 2.646 1.718
## .PhysHealth8_i 3.271 0.013 257.525 0.000 3.271 2.706
## physHealth 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## physHealth 1.000 1.000 1.000
## .PhysHealth1_i 1.099 0.019 58.201 0.000 1.099 0.643
## .PhysHealth2_i 0.846 0.015 57.579 0.000 0.846 0.627
## .PhysHealth3_i 1.300 0.021 61.433 0.000 1.300 0.733
## .PhysHealth4_i 0.978 0.018 54.510 0.000 0.978 0.563
## .PhysHealth5_i 1.364 0.023 59.432 0.000 1.364 0.676
## .PhysHealth6_i 1.313 0.022 60.461 0.000 1.313 0.707
## .PhysHealth7_i 1.603 0.027 59.503 0.000 1.603 0.676
## .PhysHealth8_i 0.890 0.016 56.946 0.000 0.890 0.609
## Categorical Treatment of the Items (WLSMV)
model.physHealth.factor <- '
physHealth =~ NA*PhysHealth1_f + PhysHealth2_f
+ PhysHealth3_f + PhysHealth4_f
+ PhysHealth5_f + PhysHealth6_f
+ PhysHealth7_f + PhysHealth8_f
physHealth ~~ 1*physHealth'
fit.physHealth.WLSMV.factor <-
cfa(model = model.physHealth.factor, data = hbsc, mimic = "Mplus",
estimator = "WLSMV",
ordered = c("PhysHealth1_f", "PhysHealth2_f",
"PhysHealth3_f", "PhysHealth4_f",
"PhysHealth5_f", "PhysHealth6_f",
"PhysHealth7_f", "PhysHealth8_f"))
summary(fit.physHealth.WLSMV.factor, fit.measures = TRUE,
standardized = TRUE)
## lavaan (0.5-22) converged normally after 11 iterations
##
## Used Total
## Number of observations 8790 9227
##
## Estimator DWLS Robust
## Minimum Function Test Statistic 395.362 698.672
## Degrees of freedom 20 20
## P-value (Chi-square) 0.000 0.000
## Scaling correction factor 0.566
## Shift parameter 0.434
## for simple second-order correction (WLSMV)
##
## Model test baseline model:
##
## Minimum Function Test Statistic 44677.484 27959.802
## Degrees of freedom 28 28
## P-value 0.000 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.992 0.976
## Tucker-Lewis Index (TLI) 0.988 0.966
##
## Robust Comparative Fit Index (CFI) NA
## Robust Tucker-Lewis Index (TLI) NA
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.046 0.062
## 90 Percent Confidence Interval 0.042 0.050 0.058 0.066
## P-value RMSEA <= 0.05 0.939 0.000
##
## Robust RMSEA NA
## 90 Percent Confidence Interval NA NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.030 0.030
##
## Weighted Root Mean Square Residual:
##
## WRMR 2.567 2.567
##
## Parameter Estimates:
##
## Information Expected
## Standard Errors Robust.sem
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## physHealth =~
## PhysHealth1_f 0.654 0.008 79.794 0.000 0.654 0.654
## PhysHealth2_f 0.662 0.008 82.597 0.000 0.662 0.662
## PhysHealth3_f 0.573 0.010 59.324 0.000 0.573 0.573
## PhysHealth4_f 0.731 0.008 95.587 0.000 0.731 0.731
## PhysHealth5_f 0.621 0.008 74.073 0.000 0.621 0.621
## PhysHealth6_f 0.589 0.009 67.774 0.000 0.589 0.589
## PhysHealth7_f 0.634 0.009 73.761 0.000 0.634 0.634
## PhysHealth8_f 0.718 0.008 85.271 0.000 0.718 0.718
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .PhysHealth1_f 0.000 0.000 0.000
## .PhysHealth2_f 0.000 0.000 0.000
## .PhysHealth3_f 0.000 0.000 0.000
## .PhysHealth4_f 0.000 0.000 0.000
## .PhysHealth5_f 0.000 0.000 0.000
## .PhysHealth6_f 0.000 0.000 0.000
## .PhysHealth7_f 0.000 0.000 0.000
## .PhysHealth8_f 0.000 0.000 0.000
## physHealth 0.000 0.000 0.000
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## PhysHlth1_f|t1 -1.423 0.020 -72.374 0.000 -1.423 -1.423
## PhysHlth1_f|t2 -0.813 0.015 -53.808 0.000 -0.813 -0.813
## PhysHlth1_f|t3 -0.506 0.014 -36.087 0.000 -0.506 -0.506
## PhysHlth1_f|t4 0.198 0.013 14.731 0.000 0.198 0.198
## PhysHlth2_f|t1 -1.681 0.023 -72.777 0.000 -1.681 -1.681
## PhysHlth2_f|t2 -1.061 0.016 -64.309 0.000 -1.061 -1.061
## PhysHlth2_f|t3 -0.701 0.015 -47.885 0.000 -0.701 -0.701
## PhysHlth2_f|t4 0.151 0.013 11.216 0.000 0.151 0.151
## PhysHlth3_f|t1 -1.378 0.019 -71.859 0.000 -1.378 -1.378
## PhysHlth3_f|t2 -0.920 0.016 -58.805 0.000 -0.920 -0.920
## PhysHlth3_f|t3 -0.605 0.014 -42.318 0.000 -0.605 -0.605
## PhysHlth3_f|t4 -0.103 0.013 -7.721 0.000 -0.103 -0.103
## PhysHlth4_f|t1 -1.385 0.019 -71.944 0.000 -1.385 -1.385
## PhysHlth4_f|t2 -0.953 0.016 -60.193 0.000 -0.953 -0.953
## PhysHlth4_f|t3 -0.641 0.014 -44.465 0.000 -0.641 -0.641
## PhysHlth4_f|t4 -0.103 0.013 -7.721 0.000 -0.103 -0.103
## PhysHlth5_f|t1 -1.125 0.017 -66.371 0.000 -1.125 -1.125
## PhysHlth5_f|t2 -0.584 0.014 -41.011 0.000 -0.584 -0.584
## PhysHlth5_f|t3 -0.219 0.013 -16.263 0.000 -0.219 -0.219
## PhysHlth5_f|t4 0.410 0.014 29.775 0.000 0.410 0.410
## PhysHlth6_f|t1 -1.267 0.018 -69.987 0.000 -1.267 -1.267
## PhysHlth6_f|t2 -0.707 0.015 -48.210 0.000 -0.707 -0.707
## PhysHlth6_f|t3 -0.279 0.014 -20.580 0.000 -0.279 -0.279
## PhysHlth6_f|t4 0.340 0.014 24.887 0.000 0.340 0.340
## PhysHlth7_f|t1 -0.980 0.016 -61.300 0.000 -0.980 -0.980
## PhysHlth7_f|t2 -0.591 0.014 -41.489 0.000 -0.591 -0.591
## PhysHlth7_f|t3 -0.314 0.014 -23.085 0.000 -0.314 -0.314
## PhysHlth7_f|t4 0.078 0.013 5.801 0.000 0.078 0.078
## PhysHlth8_f|t1 -1.568 0.021 -73.124 0.000 -1.568 -1.568
## PhysHlth8_f|t2 -1.127 0.017 -66.436 0.000 -1.127 -1.127
## PhysHlth8_f|t3 -0.860 0.015 -56.081 0.000 -0.860 -0.860
## PhysHlth8_f|t4 -0.403 0.014 -29.247 0.000 -0.403 -0.403
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## physHealth 1.000 1.000 1.000
## .PhysHealth1_f 0.573 0.573 0.573
## .PhysHealth2_f 0.562 0.562 0.562
## .PhysHealth3_f 0.672 0.672 0.672
## .PhysHealth4_f 0.466 0.466 0.466
## .PhysHealth5_f 0.615 0.615 0.615
## .PhysHealth6_f 0.653 0.653 0.653
## .PhysHealth7_f 0.598 0.598 0.598
## .PhysHealth8_f 0.485 0.485 0.485
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## PhysHealth1_f 1.000 1.000 1.000
## PhysHealth2_f 1.000 1.000 1.000
## PhysHealth3_f 1.000 1.000 1.000
## PhysHealth4_f 1.000 1.000 1.000
## PhysHealth5_f 1.000 1.000 1.000
## PhysHealth6_f 1.000 1.000 1.000
## PhysHealth7_f 1.000 1.000 1.000
## PhysHealth8_f 1.000 1.000 1.000
#### One-Factor CFA for Alcohol-Use Items
#### A Five-Item Five-Point Likert Scale
#### ("Alc1_f" Coded as Factor Variable)
#### ("Alc1_i" Coded as Integer Varable)
if(interactive()) peek(hbsc[ , c("Alc1_f", "Alc1_i", "Alc2_f", "Alc2_i",
"Alc3_f", "Alc3_i", "Alc4_f", "Alc4_i",
"Alc5_f", "Alc5_i")])
## Continuous Treatment of the Items (ML)
model.alcohol.integer <- '
alcohol =~ NA*Alc1_i + Alc2_i + Alc3_i + Alc4_i + Alc5_i
alcohol ~~ 1*alcohol
'
fit.alcohol.ML.integer <-
cfa(model = model.alcohol.integer, data = hbsc,
mimic = "Mplus", estimator = "ML")
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be ignored:
## 34 47 48 71 73 75 80 84 90 103 131 184 235 242 247 259 382 396 400 417 431 466 477 489 530 557 628 679 727 771 853 891 892 896 911 934 969 988 1015 1052 1055 1056 1062 1063 1073 1110 1132 1179 1190 1286 1287 1320 1330 1354 1360 1385 1431 1450 1477 1555 1560 1670 1672 1717 1718 1730 1735 1739 1789 1790 1805 1832 1847 1878 1882 1914 1922 1963 1966 1998 2048 2092 2137 2156 2176 2186 2220 2234 2315 2338 2341 2374 2386 2397 2491 2497 2505 2544 2556 2563 2571 2587 2603 2627 2636 2665 2708 2716 2739 2744 2808 2856 2887 2992 2995 3032 3041 3098 3198 3209 3245 3256 3276 3317 3318 3333 3342 3345 3363 3398 3399 3410 3416 3423 3439 3457 3485 3542 3550 3551 3553 3567 3568 3580 3597 3634 3638 3646 3700 3720 3736 3765 3775 3782 3796 3797 3800 3817 3831 3857 3870 3886 3923 3961 3978 3991 4061 4080 4092 4093 4122 4141 4148 4152 4161 4167 4183 4185 4209 4268 4355 4361 4388 4415 4469 4470 4471 4478 4480 4551 4552 4566 4576 4614 4655 4670 4699 4720 4833 4865 4868 4918 4939 4950 4973 4977 5019 5075 5093 5110 5153 5163 5173 5178 5187 5188 5190 5199 5241 5258 5276 5303 5378 5392 5486 5513 5570 5577 5593 5611 5615 5699 5753 5781 5783 5785 5813 5846 5918 5942 5959 5970 5994 6043 6053 6124 6150 6170 6282 6337 6426 6452 6471 6473 6492 6501 6515 6521 6541 6545 6564 6597 6599 6688 6689 6693 6708 6749 6833 6859 6879 6933 6999 7032 7049 7064 7088 7092 7107 7114 7142 7159 7234 7239 7311 7332 7344 7370 7380 7386 7418 7459 7489 7536 7577 7667 7670 7720 7742 7761 7780 7860 7931 8034 8098 8117 8153 8169 8300 8341 8344 8394 8396 8416 8421 8441 8443 8491 8493 8533 8580 8584 8595 8598 8607 8622 8641 8716 8775 8789 8792 8944 8992 9000 9005 9026 9039 9049 9061 9124 9132 9135 9159 9165 9170 9189 9209
summary(fit.alcohol.ML.integer, fit.measures = TRUE,
standardized = TRUE)
## lavaan (0.5-22) converged normally after 35 iterations
##
## Used Total
## Number of observations 8880 9227
##
## Number of missing patterns 18
##
## Estimator ML
## Minimum Function Test Statistic 276.556
## Degrees of freedom 5
## P-value (Chi-square) 0.000
##
## Model test baseline model:
##
## Minimum Function Test Statistic 27680.725
## Degrees of freedom 10
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.990
## Tucker-Lewis Index (TLI) 0.980
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -38486.475
## Loglikelihood unrestricted model (H1) -38348.197
##
## Number of free parameters 15
## Akaike (AIC) 77002.950
## Bayesian (BIC) 77109.324
## Sample-size adjusted Bayesian (BIC) 77061.656
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.078
## 90 Percent Confidence Interval 0.071 0.086
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.016
##
## Parameter Estimates:
##
## Information Observed
## Standard Errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## alcohol =~
## Alc1_i 0.593 0.007 82.963 0.000 0.593 0.765
## Alc2_i 0.411 0.007 59.312 0.000 0.411 0.595
## Alc3_i 0.715 0.007 103.931 0.000 0.715 0.890
## Alc4_i 0.736 0.008 96.044 0.000 0.736 0.846
## Alc5_i 0.754 0.007 104.738 0.000 0.754 0.892
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Alc1_i 2.355 0.008 286.201 0.000 2.355 3.038
## .Alc2_i 2.327 0.007 317.074 0.000 2.327 3.370
## .Alc3_i 2.359 0.009 275.861 0.000 2.359 2.935
## .Alc4_i 2.469 0.009 266.744 0.000 2.469 2.839
## .Alc5_i 2.425 0.009 270.231 0.000 2.425 2.870
## alcohol 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## alcohol 1.000 1.000 1.000
## .Alc1_i 0.249 0.004 58.160 0.000 0.249 0.415
## .Alc2_i 0.308 0.005 63.366 0.000 0.308 0.646
## .Alc3_i 0.134 0.003 43.382 0.000 0.134 0.208
## .Alc4_i 0.215 0.004 51.601 0.000 0.215 0.284
## .Alc5_i 0.145 0.003 43.125 0.000 0.145 0.204
## Categorical Treatment of the Items (WLSMV)
model.alcohol.factor <- '
alcohol =~ NA*Alc1_f + Alc2_f + Alc3_f + Alc4_f + Alc5_f
alcohol ~~ 1*alcohol
'
fit.alcohol.WLSMV.factor <-
cfa(model = model.alcohol.factor, data = hbsc, mimic = "Mplus",
estimator = "WLSMV",
ordered = c("Alc1_f", "Alc2_f", "Alc3_f", "Alc4_f", "Alc5_f"))
summary(fit.alcohol.WLSMV.factor, fit.measures = TRUE,
standardized = TRUE)
## lavaan (0.5-22) converged normally after 17 iterations
##
## Used Total
## Number of observations 8574 9227
##
## Estimator DWLS Robust
## Minimum Function Test Statistic 42.176 150.905
## Degrees of freedom 5 5
## P-value (Chi-square) 0.000 0.000
## Scaling correction factor 0.280
## Shift parameter 0.221
## for simple second-order correction (WLSMV)
##
## Model test baseline model:
##
## Minimum Function Test Statistic 181107.193 95425.390
## Degrees of freedom 10 10
## P-value 0.000 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 1.000 0.998
## Tucker-Lewis Index (TLI) 1.000 0.997
##
## Robust Comparative Fit Index (CFI) NA
## Robust Tucker-Lewis Index (TLI) NA
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.029 0.058
## 90 Percent Confidence Interval 0.022 0.038 0.051 0.067
## P-value RMSEA <= 0.05 1.000 0.040
##
## Robust RMSEA NA
## 90 Percent Confidence Interval NA NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.013 0.013
##
## Weighted Root Mean Square Residual:
##
## WRMR 1.186 1.186
##
## Parameter Estimates:
##
## Information Expected
## Standard Errors Robust.sem
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## alcohol =~
## Alc1_f 0.859 0.005 166.799 0.000 0.859 0.859
## Alc2_f 0.719 0.009 81.678 0.000 0.719 0.719
## Alc3_f 0.948 0.003 362.913 0.000 0.948 0.948
## Alc4_f 0.914 0.003 269.148 0.000 0.914 0.914
## Alc5_f 0.943 0.003 375.926 0.000 0.943 0.943
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Alc1_f 0.000 0.000 0.000
## .Alc2_f 0.000 0.000 0.000
## .Alc3_f 0.000 0.000 0.000
## .Alc4_f 0.000 0.000 0.000
## .Alc5_f 0.000 0.000 0.000
## alcohol 0.000 0.000 0.000
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Alc1_f|t1 0.764 0.015 50.665 0.000 0.764 0.764
## Alc1_f|t2 1.433 0.020 71.574 0.000 1.433 1.433
## Alc1_f|t3 1.778 0.025 70.971 0.000 1.778 1.778
## Alc1_f|t4 2.330 0.040 57.589 0.000 2.330 2.330
## Alc2_f|t1 0.725 0.015 48.624 0.000 0.725 0.725
## Alc2_f|t2 1.631 0.023 72.124 0.000 1.631 1.631
## Alc2_f|t3 1.955 0.029 68.045 0.000 1.955 1.955
## Alc2_f|t4 2.423 0.045 54.390 0.000 2.423 2.423
## Alc3_f|t1 0.825 0.015 53.723 0.000 0.825 0.825
## Alc3_f|t2 1.354 0.019 70.634 0.000 1.354 1.354
## Alc3_f|t3 1.739 0.024 71.406 0.000 1.739 1.739
## Alc3_f|t4 2.330 0.040 57.589 0.000 2.330 2.330
## Alc4_f|t1 0.581 0.014 40.327 0.000 0.581 0.581
## Alc4_f|t2 1.212 0.018 67.918 0.000 1.212 1.212
## Alc4_f|t3 1.678 0.023 71.893 0.000 1.678 1.678
## Alc4_f|t4 2.228 0.037 60.866 0.000 2.228 2.228
## Alc5_f|t1 0.663 0.015 45.157 0.000 0.663 0.663
## Alc5_f|t2 1.285 0.018 69.484 0.000 1.285 1.285
## Alc5_f|t3 1.685 0.023 71.846 0.000 1.685 1.685
## Alc5_f|t4 2.260 0.038 59.843 0.000 2.260 2.260
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## alcohol 1.000 1.000 1.000
## .Alc1_f 0.261 0.261 0.261
## .Alc2_f 0.483 0.483 0.483
## .Alc3_f 0.100 0.100 0.100
## .Alc4_f 0.164 0.164 0.164
## .Alc5_f 0.110 0.110 0.110
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Alc1_f 1.000 1.000 1.000
## Alc2_f 1.000 1.000 1.000
## Alc3_f 1.000 1.000 1.000
## Alc4_f 1.000 1.000 1.000
## Alc5_f 1.000 1.000 1.000
####-------------------------------------------------####
#### Section-2: A Three-Factor CFA with Likert Items ####
#### Factors: Got Bullied, Depression, Alchol Use ####
####-------------------------------------------------####
## The Continous Treatment (ML) of the Items Coded as Interger Variables
model.CFA.integer <- '
gotBully =~ NA*GotBully1_i + GotBully2_i + GotBully3_i
+ GotBully4_i + GotBully5_i + GotBully6_i
+ GotBully7_i + GotBully8_i + GotBully9_i
gotBully ~~ 1*gotBully
depress =~ NA*Depress1_i + Depress2_i + Depress3_i
+ Depress4_i + Depress5_i + Depress6_i
depress ~~ 1*depress
alcohol =~ NA*Alc1_i + Alc2_i + Alc3_i + Alc4_i + Alc5_i
alcohol ~~ 1*alcohol
'
fit.CFA.ML.integer <- cfa(model = model.CFA.integer, data = hbsc,
mimic = "Mplus", estimator = "ML")
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be ignored:
## 7489
summary(fit.CFA.ML.integer, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 51 iterations
##
## Used Total
## Number of observations 9226 9227
##
## Number of missing patterns 144
##
## Estimator ML
## Minimum Function Test Statistic 5605.569
## Degrees of freedom 167
## P-value (Chi-square) 0.000
##
## Model test baseline model:
##
## Minimum Function Test Statistic 70049.784
## Degrees of freedom 190
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.922
## Tucker-Lewis Index (TLI) 0.911
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -195609.297
## Loglikelihood unrestricted model (H1) -192806.513
##
## Number of free parameters 63
## Akaike (AIC) 391344.594
## Bayesian (BIC) 391793.770
## Sample-size adjusted Bayesian (BIC) 391593.566
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.059
## 90 Percent Confidence Interval 0.058 0.061
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.039
##
## Parameter Estimates:
##
## Information Observed
## Standard Errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## gotBully =~
## GotBully1_i 0.738 0.013 58.099 0.000 0.738 0.636
## GotBully2_i 0.652 0.011 58.097 0.000 0.652 0.635
## GotBully3_i 0.565 0.009 65.443 0.000 0.565 0.691
## GotBully4_i 0.711 0.012 61.733 0.000 0.711 0.664
## GotBully5_i 0.568 0.009 64.877 0.000 0.568 0.689
## GotBully6_i 0.478 0.007 65.195 0.000 0.478 0.695
## GotBully7_i 0.659 0.012 56.885 0.000 0.659 0.622
## GotBully8_i 0.415 0.007 60.721 0.000 0.415 0.664
## GotBully9_i 0.380 0.006 58.715 0.000 0.380 0.647
## depress =~
## Depress1_i 0.776 0.011 67.712 0.000 0.776 0.697
## Depress2_i 0.703 0.012 59.863 0.000 0.703 0.630
## Depress3_i 0.808 0.013 63.979 0.000 0.808 0.664
## Depress4_i 0.879 0.014 63.234 0.000 0.879 0.661
## Depress5_i 0.779 0.015 53.048 0.000 0.779 0.573
## Depress6_i 0.761 0.014 52.764 0.000 0.761 0.567
## alcohol =~
## Alc1_i 0.593 0.007 82.992 0.000 0.593 0.765
## Alc2_i 0.411 0.007 59.398 0.000 0.411 0.596
## Alc3_i 0.715 0.007 103.913 0.000 0.715 0.890
## Alc4_i 0.736 0.008 96.041 0.000 0.736 0.846
## Alc5_i 0.754 0.007 104.710 0.000 0.754 0.892
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## gotBully ~~
## depress -0.032 0.014 -2.364 0.018 -0.032 -0.032
## alcohol 0.126 0.012 10.303 0.000 0.126 0.126
## depress ~~
## alcohol 0.002 0.012 0.163 0.871 0.002 0.002
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .GotBully1_i 0.660 0.013 49.959 0.000 0.660 0.568
## .GotBully2_i 0.510 0.012 43.659 0.000 0.510 0.497
## .GotBully3_i 0.280 0.009 30.146 0.000 0.280 0.343
## .GotBully4_i 0.609 0.012 49.995 0.000 0.609 0.569
## .GotBully5_i 0.278 0.009 29.543 0.000 0.278 0.337
## .GotBully6_i 0.189 0.008 24.168 0.000 0.189 0.275
## .GotBully7_i 0.512 0.012 42.471 0.000 0.512 0.484
## .GotBully8_i 0.160 0.007 22.467 0.000 0.160 0.256
## .GotBully9_i 0.131 0.007 19.546 0.000 0.131 0.223
## .Depress1_i 2.595 0.012 221.977 0.000 2.595 2.330
## .Depress2_i 2.231 0.012 190.300 0.000 2.231 1.999
## .Depress3_i 3.105 0.013 242.795 0.000 3.105 2.551
## .Depress4_i 2.751 0.014 196.566 0.000 2.751 2.067
## .Depress5_i 2.484 0.014 173.721 0.000 2.484 1.828
## .Depress6_i 2.376 0.014 168.570 0.000 2.376 1.771
## .Alc1_i 2.355 0.008 286.206 0.000 2.355 3.038
## .Alc2_i 2.327 0.007 317.071 0.000 2.327 3.370
## .Alc3_i 2.359 0.009 275.861 0.000 2.359 2.935
## .Alc4_i 2.469 0.009 266.751 0.000 2.469 2.839
## .Alc5_i 2.426 0.009 270.218 0.000 2.426 2.870
## gotBully 0.000 0.000 0.000
## depress 0.000 0.000 0.000
## alcohol 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## gotBully 1.000 1.000 1.000
## depress 1.000 1.000 1.000
## alcohol 1.000 1.000 1.000
## .GotBully1_i 0.804 0.015 54.753 0.000 0.804 0.596
## .GotBully2_i 0.629 0.011 55.132 0.000 0.629 0.597
## .GotBully3_i 0.348 0.006 53.731 0.000 0.348 0.522
## .GotBully4_i 0.640 0.012 54.024 0.000 0.640 0.559
## .GotBully5_i 0.358 0.007 53.460 0.000 0.358 0.526
## .GotBully6_i 0.244 0.005 52.424 0.000 0.244 0.516
## .GotBully7_i 0.687 0.012 56.048 0.000 0.687 0.613
## .GotBully8_i 0.219 0.004 53.523 0.000 0.219 0.560
## .GotBully9_i 0.200 0.004 54.087 0.000 0.200 0.581
## .Depress1_i 0.637 0.013 50.870 0.000 0.637 0.514
## .Depress2_i 0.752 0.013 56.087 0.000 0.752 0.603
## .Depress3_i 0.827 0.015 53.900 0.000 0.827 0.559
## .Depress4_i 0.997 0.019 53.698 0.000 0.997 0.563
## .Depress5_i 1.240 0.021 58.484 0.000 1.240 0.672
## .Depress6_i 1.220 0.021 59.227 0.000 1.220 0.678
## .Alc1_i 0.249 0.004 58.160 0.000 0.249 0.414
## .Alc2_i 0.308 0.005 63.351 0.000 0.308 0.645
## .Alc3_i 0.135 0.003 43.452 0.000 0.135 0.208
## .Alc4_i 0.215 0.004 51.619 0.000 0.215 0.284
## .Alc5_i 0.146 0.003 43.197 0.000 0.146 0.204
## The Categorical Treatment (WLSMV) of the Items Coded as Factor Variables
model.CFA.factor <- '
gotBully =~ NA*GotBully1_f + GotBully2_f + GotBully3_f
+ GotBully4_f + GotBully5_f + GotBully6_f
+ GotBully7_f + GotBully8_f + GotBully9_f
gotBully ~~ 1*gotBully
depress =~ NA*Depress1_f + Depress2_f + Depress3_f
+ Depress4_f + Depress5_f + Depress6_f
depress ~~ 1*depress
alcohol =~ NA*Alc1_f + Alc2_f + Alc3_f + Alc4_f + Alc5_f
alcohol ~~ 1*alcohol
'
fit.CFA.WLSMV.factor <-
cfa(model = model.CFA.factor, data = hbsc, mimic = "Mplus",
estimator = "WLSMV",
ordered = c("GotBully1_f", "GotBully2_f","GotBully3_f",
"GotBully4_f", "GotBully5_f", "GotBully6_f",
"GotBully7_f", "GotBully8_f", "GotBully9_f",
"Depress1_f", "Depress2_f", "Depress3_f",
"Depress4_f", "Depress5_f", "Depress6_f",
"Alc1_f", "Alc2_f", "Alc3_f", "Alc4_f", "Alc5_f"))
## Warning in pc_cor_TS(fit.y1 = UNI[[i]], fit.y2 = UNI[[j]], method =
## optim.method, : lavaan WARNING: empty cell(s) in bivariate table of Alc1_f
## x GotBully5_f
## Warning in pc_cor_TS(fit.y1 = UNI[[i]], fit.y2 = UNI[[j]], method =
## optim.method, : lavaan WARNING: empty cell(s) in bivariate table of Alc2_f
## x GotBully6_f
## Warning in pc_cor_TS(fit.y1 = UNI[[i]], fit.y2 = UNI[[j]], method =
## optim.method, : lavaan WARNING: empty cell(s) in bivariate table of Alc3_f
## x Alc1_f
summary(fit.CFA.WLSMV.factor, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 23 iterations
##
## Used Total
## Number of observations 7118 9227
##
## Estimator DWLS Robust
## Minimum Function Test Statistic 2633.734 2956.403
## Degrees of freedom 167 167
## P-value (Chi-square) 0.000 0.000
## Scaling correction factor 0.908
## Shift parameter 54.705
## for simple second-order correction (WLSMV)
##
## Model test baseline model:
##
## Minimum Function Test Statistic 281854.962 116758.089
## Degrees of freedom 190 190
## P-value 0.000 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.991 0.976
## Tucker-Lewis Index (TLI) 0.990 0.973
##
## Robust Comparative Fit Index (CFI) NA
## Robust Tucker-Lewis Index (TLI) NA
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.046 0.048
## 90 Percent Confidence Interval 0.044 0.047 0.047 0.050
## P-value RMSEA <= 0.05 1.000 0.952
##
## Robust RMSEA NA
## 90 Percent Confidence Interval NA NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.056 0.056
##
## Weighted Root Mean Square Residual:
##
## WRMR 3.123 3.123
##
## Parameter Estimates:
##
## Information Expected
## Standard Errors Robust.sem
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## gotBully =~
## GotBully1_f 0.770 0.009 88.670 0.000 0.770 0.770
## GotBully2_f 0.768 0.009 86.818 0.000 0.768 0.768
## GotBully3_f 0.788 0.010 82.757 0.000 0.788 0.788
## GotBully4_f 0.798 0.008 100.315 0.000 0.798 0.798
## GotBully5_f 0.811 0.009 89.131 0.000 0.811 0.811
## GotBully6_f 0.833 0.010 85.049 0.000 0.833 0.833
## GotBully7_f 0.770 0.009 83.040 0.000 0.770 0.770
## GotBully8_f 0.858 0.009 93.706 0.000 0.858 0.858
## GotBully9_f 0.883 0.010 87.972 0.000 0.883 0.883
## depress =~
## Depress1_f 0.735 0.008 97.433 0.000 0.735 0.735
## Depress2_f 0.659 0.009 77.531 0.000 0.659 0.659
## Depress3_f 0.756 0.008 90.034 0.000 0.756 0.756
## Depress4_f 0.721 0.008 85.753 0.000 0.721 0.721
## Depress5_f 0.634 0.009 67.906 0.000 0.634 0.634
## Depress6_f 0.633 0.010 65.896 0.000 0.633 0.633
## alcohol =~
## Alc1_f 0.847 0.006 145.236 0.000 0.847 0.847
## Alc2_f 0.701 0.010 70.730 0.000 0.701 0.701
## Alc3_f 0.946 0.003 330.362 0.000 0.946 0.946
## Alc4_f 0.916 0.004 256.281 0.000 0.916 0.916
## Alc5_f 0.943 0.003 338.644 0.000 0.943 0.943
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## gotBully ~~
## depress 0.394 0.015 26.613 0.000 0.394 0.394
## alcohol 0.133 0.018 7.545 0.000 0.133 0.133
## depress ~~
## alcohol 0.308 0.015 20.479 0.000 0.308 0.308
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .GotBully1_f 0.000 0.000 0.000
## .GotBully2_f 0.000 0.000 0.000
## .GotBully3_f 0.000 0.000 0.000
## .GotBully4_f 0.000 0.000 0.000
## .GotBully5_f 0.000 0.000 0.000
## .GotBully6_f 0.000 0.000 0.000
## .GotBully7_f 0.000 0.000 0.000
## .GotBully8_f 0.000 0.000 0.000
## .GotBully9_f 0.000 0.000 0.000
## .Depress1_f 0.000 0.000 0.000
## .Depress2_f 0.000 0.000 0.000
## .Depress3_f 0.000 0.000 0.000
## .Depress4_f 0.000 0.000 0.000
## .Depress5_f 0.000 0.000 0.000
## .Depress6_f 0.000 0.000 0.000
## .Alc1_f 0.000 0.000 0.000
## .Alc2_f 0.000 0.000 0.000
## .Alc3_f 0.000 0.000 0.000
## .Alc4_f 0.000 0.000 0.000
## .Alc5_f 0.000 0.000 0.000
## gotBully 0.000 0.000 0.000
## depress 0.000 0.000 0.000
## alcohol 0.000 0.000 0.000
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## GotBully1_f|t1 0.435 0.015 28.301 0.000 0.435 0.435
## GotBully1_f|t2 1.046 0.018 57.399 0.000 1.046 1.046
## GotBully1_f|t3 1.262 0.020 62.898 0.000 1.262 1.262
## GotBully1_f|t4 1.528 0.023 65.741 0.000 1.528 1.528
## GotBully2_f|t1 0.618 0.016 38.776 0.000 0.618 0.618
## GotBully2_f|t2 1.198 0.019 61.556 0.000 1.198 1.198
## GotBully2_f|t3 1.422 0.022 65.116 0.000 1.422 1.422
## GotBully2_f|t4 1.736 0.027 65.085 0.000 1.736 1.736
## GotBully3_f|t1 1.088 0.019 58.696 0.000 1.088 1.088
## GotBully3_f|t2 1.518 0.023 65.710 0.000 1.518 1.518
## GotBully3_f|t3 1.734 0.027 65.099 0.000 1.734 1.734
## GotBully3_f|t4 1.987 0.032 61.363 0.000 1.987 1.987
## GotBully4_f|t1 0.425 0.015 27.691 0.000 0.425 0.425
## GotBully4_f|t2 1.111 0.019 59.362 0.000 1.111 1.111
## GotBully4_f|t3 1.399 0.022 64.893 0.000 1.399 1.399
## GotBully4_f|t4 1.664 0.025 65.580 0.000 1.664 1.664
## GotBully5_f|t1 1.119 0.019 59.563 0.000 1.119 1.119
## GotBully5_f|t2 1.520 0.023 65.717 0.000 1.520 1.520
## GotBully5_f|t3 1.711 0.026 65.288 0.000 1.711 1.711
## GotBully5_f|t4 1.965 0.032 61.806 0.000 1.965 1.965
## GotBully6_f|t1 1.340 0.021 64.166 0.000 1.340 1.340
## GotBully6_f|t2 1.696 0.026 65.394 0.000 1.696 1.696
## GotBully6_f|t3 1.890 0.030 63.136 0.000 1.890 1.890
## GotBully6_f|t4 2.134 0.037 57.988 0.000 2.134 2.134
## GotBully7_f|t1 0.677 0.016 41.906 0.000 0.677 0.677
## GotBully7_f|t2 1.155 0.019 60.524 0.000 1.155 1.155
## GotBully7_f|t3 1.405 0.022 64.960 0.000 1.405 1.405
## GotBully7_f|t4 1.696 0.026 65.394 0.000 1.696 1.696
## GotBully8_f|t1 1.404 0.022 64.941 0.000 1.404 1.404
## GotBully8_f|t2 1.800 0.028 64.421 0.000 1.800 1.800
## GotBully8_f|t3 2.027 0.033 60.528 0.000 2.027 2.027
## GotBully8_f|t4 2.237 0.041 55.198 0.000 2.237 2.237
## GotBully9_f|t1 1.544 0.023 65.776 0.000 1.544 1.544
## GotBully9_f|t2 1.878 0.030 63.335 0.000 1.878 1.878
## GotBully9_f|t3 2.058 0.034 59.830 0.000 2.058 2.058
## GotBully9_f|t4 2.241 0.041 55.075 0.000 2.241 2.241
## Depress1_f|t1 -0.666 0.016 -41.337 0.000 -0.666 -0.666
## Depress1_f|t2 0.095 0.015 6.399 0.000 0.095 0.095
## Depress1_f|t3 1.004 0.018 55.999 0.000 1.004 1.004
## Depress1_f|t4 1.723 0.026 65.192 0.000 1.723 1.723
## Depress2_f|t1 -1.046 0.018 -57.399 0.000 -1.046 -1.046
## Depress2_f|t2 -0.295 0.015 -19.552 0.000 -0.295 -0.295
## Depress2_f|t3 0.688 0.016 42.429 0.000 0.688 0.688
## Depress2_f|t4 1.532 0.023 65.749 0.000 1.532 1.532
## Depress3_f|t1 0.142 0.015 9.550 0.000 0.142 0.142
## Depress3_f|t2 0.607 0.016 38.178 0.000 0.607 0.607
## Depress3_f|t3 1.137 0.019 60.066 0.000 1.137 1.137
## Depress3_f|t4 1.612 0.025 65.766 0.000 1.612 1.612
## Depress4_f|t1 -0.174 0.015 -11.633 0.000 -0.174 -0.174
## Depress4_f|t2 0.228 0.015 15.205 0.000 0.228 0.228
## Depress4_f|t3 0.841 0.017 49.664 0.000 0.841 0.841
## Depress4_f|t4 1.433 0.022 65.218 0.000 1.433 1.433
## Depress5_f|t1 -0.456 0.015 -29.541 0.000 -0.456 -0.456
## Depress5_f|t2 0.033 0.015 2.252 0.024 0.033 0.033
## Depress5_f|t3 0.665 0.016 41.292 0.000 0.665 0.665
## Depress5_f|t4 1.248 0.020 62.615 0.000 1.248 1.248
## Depress6_f|t1 -0.618 0.016 -38.799 0.000 -0.618 -0.618
## Depress6_f|t2 -0.055 0.015 -3.721 0.000 -0.055 -0.055
## Depress6_f|t3 0.618 0.016 38.799 0.000 0.618 0.618
## Depress6_f|t4 1.179 0.019 61.124 0.000 1.179 1.179
## Alc1_f|t1 0.699 0.016 42.995 0.000 0.699 0.699
## Alc1_f|t2 1.384 0.021 64.731 0.000 1.384 1.384
## Alc1_f|t3 1.745 0.027 64.998 0.000 1.745 1.745
## Alc1_f|t4 2.396 0.048 50.414 0.000 2.396 2.396
## Alc2_f|t1 0.668 0.016 41.406 0.000 0.668 0.668
## Alc2_f|t2 1.601 0.024 65.784 0.000 1.601 1.601
## Alc2_f|t3 1.955 0.032 61.991 0.000 1.955 1.955
## Alc2_f|t4 2.478 0.052 47.774 0.000 2.478 2.478
## Alc3_f|t1 0.746 0.016 45.313 0.000 0.746 0.746
## Alc3_f|t2 1.297 0.020 63.507 0.000 1.297 1.297
## Alc3_f|t3 1.696 0.026 65.394 0.000 1.696 1.696
## Alc3_f|t4 2.384 0.047 50.799 0.000 2.384 2.384
## Alc4_f|t1 0.507 0.016 32.552 0.000 0.507 0.507
## Alc4_f|t2 1.159 0.019 60.628 0.000 1.159 1.159
## Alc4_f|t3 1.653 0.025 65.632 0.000 1.653 1.653
## Alc4_f|t4 2.292 0.043 53.606 0.000 2.292 2.292
## Alc5_f|t1 0.585 0.016 37.003 0.000 0.585 0.585
## Alc5_f|t2 1.225 0.020 62.152 0.000 1.225 1.225
## Alc5_f|t3 1.645 0.025 65.666 0.000 1.645 1.645
## Alc5_f|t4 2.282 0.042 53.891 0.000 2.282 2.282
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## gotBully 1.000 1.000 1.000
## depress 1.000 1.000 1.000
## alcohol 1.000 1.000 1.000
## .GotBully1_f 0.407 0.407 0.407
## .GotBully2_f 0.411 0.411 0.411
## .GotBully3_f 0.380 0.380 0.380
## .GotBully4_f 0.363 0.363 0.363
## .GotBully5_f 0.342 0.342 0.342
## .GotBully6_f 0.306 0.306 0.306
## .GotBully7_f 0.406 0.406 0.406
## .GotBully8_f 0.264 0.264 0.264
## .GotBully9_f 0.221 0.221 0.221
## .Depress1_f 0.460 0.460 0.460
## .Depress2_f 0.565 0.565 0.565
## .Depress3_f 0.428 0.428 0.428
## .Depress4_f 0.480 0.480 0.480
## .Depress5_f 0.598 0.598 0.598
## .Depress6_f 0.599 0.599 0.599
## .Alc1_f 0.282 0.282 0.282
## .Alc2_f 0.509 0.509 0.509
## .Alc3_f 0.106 0.106 0.106
## .Alc4_f 0.161 0.161 0.161
## .Alc5_f 0.110 0.110 0.110
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## GotBully1_f 1.000 1.000 1.000
## GotBully2_f 1.000 1.000 1.000
## GotBully3_f 1.000 1.000 1.000
## GotBully4_f 1.000 1.000 1.000
## GotBully5_f 1.000 1.000 1.000
## GotBully6_f 1.000 1.000 1.000
## GotBully7_f 1.000 1.000 1.000
## GotBully8_f 1.000 1.000 1.000
## GotBully9_f 1.000 1.000 1.000
## Depress1_f 1.000 1.000 1.000
## Depress2_f 1.000 1.000 1.000
## Depress3_f 1.000 1.000 1.000
## Depress4_f 1.000 1.000 1.000
## Depress5_f 1.000 1.000 1.000
## Depress6_f 1.000 1.000 1.000
## Alc1_f 1.000 1.000 1.000
## Alc2_f 1.000 1.000 1.000
## Alc3_f 1.000 1.000 1.000
## Alc4_f 1.000 1.000 1.000
## Alc5_f 1.000 1.000 1.000
####------------------------------------------------------------####
#### Section-3: A Two-Factor Structural Model with Likert Items ####
#### Got Bullied Predicts Alcohol Use ####
####------------------------------------------------------------####
## The Continuous Treatment (ML) of the Structural Model
## The Variables for this Model Are Coded as Integers
model.struc.ML <- '
## the measurement model
gotBully =~ NA*GotBully1_i + GotBully2_i + GotBully3_i
+ GotBully4_i + GotBully5_i + GotBully6_i
+ GotBully7_i + GotBully8_i + GotBully9_i
gotBully ~~ 1*gotBully
alcohol =~ NA*Alc1_i + Alc2_i + Alc3_i + Alc4_i + Alc5_i
alcohol ~~ 1*alcohol
# regress
alcohol ~ gotBully
'
fit.struc.ML <- sem(model = model.struc.ML, data = hbsc,
mimic = "Mplus", estimator = "ML")
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be ignored:
## 34 47 48 71 73 80 84 90 103 131 184 235 242 247 259 382 396 400 417 466 477 489 530 557 628 679 727 771 853 891 892 896 911 934 969 1015 1052 1055 1056 1062 1063 1073 1132 1179 1190 1320 1330 1354 1360 1385 1450 1555 1560 1670 1672 1717 1718 1730 1735 1739 1789 1790 1805 1832 1882 1914 1922 1963 1966 1998 2048 2137 2156 2176 2186 2234 2338 2374 2386 2397 2491 2505 2544 2556 2563 2571 2587 2603 2627 2636 2665 2708 2716 2739 2744 2808 2887 2992 2995 3032 3041 3098 3198 3209 3245 3256 3276 3317 3333 3342 3345 3363 3398 3399 3410 3423 3439 3457 3485 3542 3550 3551 3567 3568 3580 3597 3638 3700 3720 3736 3765 3775 3782 3796 3797 3800 3817 3831 3870 3886 3923 3961 3991 4061 4080 4092 4093 4122 4141 4148 4152 4161 4167 4183 4209 4268 4355 4361 4388 4415 4469 4470 4471 4478 4480 4552 4566 4576 4614 4670 4699 4720 4833 4865 4868 4939 4973 4977 5075 5093 5110 5153 5178 5187 5190 5199 5241 5276 5303 5378 5392 5513 5570 5577 5593 5615 5699 5753 5781 5785 5813 5846 5918 5942 5959 5994 6053 6170 6282 6337 6426 6452 6471 6473 6492 6501 6515 6521 6545 6564 6599 6688 6689 6693 6749 6859 6933 6999 7032 7049 7064 7088 7092 7114 7142 7159 7234 7239 7311 7332 7344 7386 7418 7459 7489 7577 7667 7720 7742 7761 7780 7931 8034 8098 8117 8153 8300 8341 8396 8416 8421 8443 8493 8584 8598 8607 8622 8641 8716 8789 8944 9000 9026 9039 9049 9061 9124 9132 9135 9159 9165 9209
summary(fit.struc.ML, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 47 iterations
##
## Used Total
## Number of observations 8945 9227
##
## Number of missing patterns 85
##
## Estimator ML
## Minimum Function Test Statistic 4942.497
## Degrees of freedom 76
## P-value (Chi-square) 0.000
##
## Model test baseline model:
##
## Minimum Function Test Statistic 56031.094
## Degrees of freedom 91
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.913
## Tucker-Lewis Index (TLI) 0.896
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -113567.150
## Loglikelihood unrestricted model (H1) -111095.902
##
## Number of free parameters 43
## Akaike (AIC) 227220.300
## Bayesian (BIC) 227525.551
## Sample-size adjusted Bayesian (BIC) 227388.904
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.085
## 90 Percent Confidence Interval 0.083 0.087
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.052
##
## Parameter Estimates:
##
## Information Observed
## Standard Errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## gotBully =~
## GotBully1_i 0.738 0.013 58.090 0.000 0.738 0.636
## GotBully2_i 0.652 0.011 58.094 0.000 0.652 0.635
## GotBully3_i 0.565 0.009 65.444 0.000 0.565 0.691
## GotBully4_i 0.711 0.012 61.729 0.000 0.711 0.664
## GotBully5_i 0.568 0.009 64.873 0.000 0.568 0.689
## GotBully6_i 0.478 0.007 65.200 0.000 0.478 0.695
## GotBully7_i 0.659 0.012 56.883 0.000 0.659 0.622
## GotBully8_i 0.415 0.007 60.728 0.000 0.415 0.664
## GotBully9_i 0.380 0.006 58.713 0.000 0.380 0.647
## alcohol =~
## Alc1_i 0.588 0.007 82.822 0.000 0.593 0.765
## Alc2_i 0.408 0.007 59.371 0.000 0.411 0.596
## Alc3_i 0.709 0.007 103.518 0.000 0.715 0.890
## Alc4_i 0.730 0.008 95.739 0.000 0.736 0.846
## Alc5_i 0.748 0.007 104.304 0.000 0.754 0.892
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## alcohol ~
## gotBully 0.128 0.013 10.143 0.000 0.127 0.127
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .GotBully1_i 0.659 0.013 49.950 0.000 0.659 0.568
## .GotBully2_i 0.510 0.012 43.650 0.000 0.510 0.497
## .GotBully3_i 0.280 0.009 30.137 0.000 0.280 0.343
## .GotBully4_i 0.609 0.012 49.985 0.000 0.609 0.569
## .GotBully5_i 0.277 0.009 29.534 0.000 0.277 0.336
## .GotBully6_i 0.189 0.008 24.158 0.000 0.189 0.275
## .GotBully7_i 0.512 0.012 42.462 0.000 0.512 0.484
## .GotBully8_i 0.160 0.007 22.458 0.000 0.160 0.256
## .GotBully9_i 0.131 0.007 19.538 0.000 0.131 0.223
## .Alc1_i 2.355 0.008 286.206 0.000 2.355 3.038
## .Alc2_i 2.327 0.007 317.072 0.000 2.327 3.370
## .Alc3_i 2.359 0.009 275.862 0.000 2.359 2.935
## .Alc4_i 2.469 0.009 266.752 0.000 2.469 2.839
## .Alc5_i 2.426 0.009 270.218 0.000 2.426 2.870
## gotBully 0.000 0.000 0.000
## .alcohol 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## gotBully 1.000 1.000 1.000
## .alcohol 1.000 0.984 0.984
## .GotBully1_i 0.804 0.015 54.753 0.000 0.804 0.596
## .GotBully2_i 0.629 0.011 55.131 0.000 0.629 0.597
## .GotBully3_i 0.348 0.006 53.729 0.000 0.348 0.522
## .GotBully4_i 0.640 0.012 54.024 0.000 0.640 0.559
## .GotBully5_i 0.358 0.007 53.460 0.000 0.358 0.526
## .GotBully6_i 0.244 0.005 52.421 0.000 0.244 0.516
## .GotBully7_i 0.687 0.012 56.047 0.000 0.687 0.613
## .GotBully8_i 0.219 0.004 53.519 0.000 0.219 0.559
## .GotBully9_i 0.200 0.004 54.086 0.000 0.200 0.581
## .Alc1_i 0.249 0.004 58.160 0.000 0.249 0.414
## .Alc2_i 0.308 0.005 63.351 0.000 0.308 0.645
## .Alc3_i 0.135 0.003 43.451 0.000 0.135 0.208
## .Alc4_i 0.215 0.004 51.620 0.000 0.215 0.284
## .Alc5_i 0.146 0.003 43.200 0.000 0.146 0.204
## The Categorical Treatment (WLSMV) of the Structural Model
## The Variables for this Model Are Coded as Factors
model.struc.WLSMV <- '
## the measurement model
gotBully =~ NA*GotBully1_f + GotBully2_f + GotBully3_f + GotBully4_f
+ GotBully5_f + GotBully6_f + GotBully7_f + GotBully8_f
+ GotBully9_f
gotBully ~~ 1*gotBully
alcohol =~ NA*Alc1_f + Alc2_f + Alc3_f + Alc4_f + Alc5_f
alcohol ~~ 1*alcohol
## the structural model
alcohol ~ gotBully
'
fit.struc.WLSMV <-
sem(model = model.struc.WLSMV, data = hbsc, mimic = "Mplus",
estimator = "WLSMV", ordered = c("GotBully1_f", "GotBully2_f",
"GotBully3_f", "GotBully4_f",
"GotBully5_f", "GotBully6_f",
"GotBully7_f", "GotBully8_f",
"GotBully9_f",
"Alc1_f", "Alc2_f", "Alc3_f",
"Alc4_f", "Alc5_f"))
## Warning in pc_cor_TS(fit.y1 = UNI[[i]], fit.y2 = UNI[[j]], method =
## optim.method, : lavaan WARNING: empty cell(s) in bivariate table of Alc1_f
## x GotBully5_f
## Warning in pc_cor_TS(fit.y1 = UNI[[i]], fit.y2 = UNI[[j]], method =
## optim.method, : lavaan WARNING: empty cell(s) in bivariate table of Alc2_f
## x GotBully6_f
## Warning in pc_cor_TS(fit.y1 = UNI[[i]], fit.y2 = UNI[[j]], method =
## optim.method, : lavaan WARNING: empty cell(s) in bivariate table of Alc3_f
## x Alc1_f
summary(fit.struc.WLSMV, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 24 iterations
##
## Used Total
## Number of observations 7232 9227
##
## Estimator DWLS Robust
## Minimum Function Test Statistic 1477.149 1810.161
## Degrees of freedom 76 76
## P-value (Chi-square) 0.000 0.000
## Scaling correction factor 0.827
## Shift parameter 24.571
## for simple second-order correction (WLSMV)
##
## Model test baseline model:
##
## Minimum Function Test Statistic 237248.778 94697.365
## Degrees of freedom 91 91
## P-value 0.000 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.994 0.982
## Tucker-Lewis Index (TLI) 0.993 0.978
##
## Robust Comparative Fit Index (CFI) NA
## Robust Tucker-Lewis Index (TLI) NA
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.050 0.056
## 90 Percent Confidence Interval 0.048 0.053 0.054 0.058
## P-value RMSEA <= 0.05 0.354 0.000
##
## Robust RMSEA NA
## 90 Percent Confidence Interval NA NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.061 0.061
##
## Weighted Root Mean Square Residual:
##
## WRMR 3.170 3.170
##
## Parameter Estimates:
##
## Information Expected
## Standard Errors Robust.sem
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## gotBully =~
## GotBully1_f 0.766 0.009 88.419 0.000 0.766 0.766
## GotBully2_f 0.762 0.009 86.542 0.000 0.762 0.762
## GotBully3_f 0.801 0.009 87.196 0.000 0.801 0.801
## GotBully4_f 0.782 0.008 99.315 0.000 0.782 0.782
## GotBully5_f 0.818 0.009 92.901 0.000 0.818 0.818
## GotBully6_f 0.849 0.009 90.780 0.000 0.849 0.849
## GotBully7_f 0.752 0.009 80.652 0.000 0.752 0.752
## GotBully8_f 0.866 0.009 98.981 0.000 0.866 0.866
## GotBully9_f 0.895 0.010 93.624 0.000 0.895 0.895
## alcohol =~
## Alc1_f 0.843 0.006 142.809 0.000 0.851 0.851
## Alc2_f 0.697 0.010 72.353 0.000 0.704 0.704
## Alc3_f 0.937 0.004 262.302 0.000 0.946 0.946
## Alc4_f 0.907 0.004 219.300 0.000 0.915 0.915
## Alc5_f 0.934 0.004 262.119 0.000 0.942 0.942
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## alcohol ~
## gotBully 0.138 0.018 7.639 0.000 0.136 0.136
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .GotBully1_f 0.000 0.000 0.000
## .GotBully2_f 0.000 0.000 0.000
## .GotBully3_f 0.000 0.000 0.000
## .GotBully4_f 0.000 0.000 0.000
## .GotBully5_f 0.000 0.000 0.000
## .GotBully6_f 0.000 0.000 0.000
## .GotBully7_f 0.000 0.000 0.000
## .GotBully8_f 0.000 0.000 0.000
## .GotBully9_f 0.000 0.000 0.000
## .Alc1_f 0.000 0.000 0.000
## .Alc2_f 0.000 0.000 0.000
## .Alc3_f 0.000 0.000 0.000
## .Alc4_f 0.000 0.000 0.000
## .Alc5_f 0.000 0.000 0.000
## gotBully 0.000 0.000 0.000
## .alcohol 0.000 0.000 0.000
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## GotBully1_f|t1 0.436 0.015 28.568 0.000 0.436 0.436
## GotBully1_f|t2 1.046 0.018 57.874 0.000 1.046 1.046
## GotBully1_f|t3 1.261 0.020 63.382 0.000 1.261 1.261
## GotBully1_f|t4 1.529 0.023 66.266 0.000 1.529 1.529
## GotBully2_f|t1 0.616 0.016 39.007 0.000 0.616 0.616
## GotBully2_f|t2 1.197 0.019 62.018 0.000 1.197 1.197
## GotBully2_f|t3 1.423 0.022 65.642 0.000 1.423 1.423
## GotBully2_f|t4 1.738 0.027 65.580 0.000 1.738 1.738
## GotBully3_f|t1 1.084 0.018 59.030 0.000 1.084 1.084
## GotBully3_f|t2 1.516 0.023 66.228 0.000 1.516 1.516
## GotBully3_f|t3 1.732 0.026 65.636 0.000 1.732 1.732
## GotBully3_f|t4 1.989 0.032 61.817 0.000 1.989 1.989
## GotBully4_f|t1 0.425 0.015 27.871 0.000 0.425 0.425
## GotBully4_f|t2 1.109 0.019 59.767 0.000 1.109 1.109
## GotBully4_f|t3 1.395 0.021 65.374 0.000 1.395 1.395
## GotBully4_f|t4 1.663 0.025 66.107 0.000 1.663 1.663
## GotBully5_f|t1 1.113 0.019 59.876 0.000 1.113 1.113
## GotBully5_f|t2 1.515 0.023 66.224 0.000 1.515 1.515
## GotBully5_f|t3 1.708 0.026 65.831 0.000 1.708 1.708
## GotBully5_f|t4 1.964 0.032 62.308 0.000 1.964 1.964
## GotBully6_f|t1 1.340 0.021 64.681 0.000 1.340 1.340
## GotBully6_f|t2 1.692 0.026 65.944 0.000 1.692 1.692
## GotBully6_f|t3 1.889 0.030 63.662 0.000 1.889 1.889
## GotBully6_f|t4 2.133 0.036 58.462 0.000 2.133 2.133
## GotBully7_f|t1 0.678 0.016 42.295 0.000 0.678 0.678
## GotBully7_f|t2 1.156 0.019 61.043 0.000 1.156 1.156
## GotBully7_f|t3 1.406 0.021 65.480 0.000 1.406 1.406
## GotBully7_f|t4 1.699 0.026 65.895 0.000 1.699 1.699
## GotBully8_f|t1 1.402 0.021 65.442 0.000 1.402 1.402
## GotBully8_f|t2 1.796 0.028 64.974 0.000 1.796 1.796
## GotBully8_f|t3 2.020 0.033 61.162 0.000 2.020 2.020
## GotBully8_f|t4 2.226 0.040 55.943 0.000 2.226 2.226
## GotBully9_f|t1 1.541 0.023 66.295 0.000 1.541 1.541
## GotBully9_f|t2 1.875 0.029 63.890 0.000 1.875 1.875
## GotBully9_f|t3 2.050 0.034 60.487 0.000 2.050 2.050
## GotBully9_f|t4 2.239 0.040 55.585 0.000 2.239 2.239
## Alc1_f|t1 0.700 0.016 43.374 0.000 0.700 0.700
## Alc1_f|t2 1.384 0.021 65.253 0.000 1.384 1.384
## Alc1_f|t3 1.742 0.027 65.552 0.000 1.742 1.742
## Alc1_f|t4 2.372 0.046 51.578 0.000 2.372 2.372
## Alc2_f|t1 0.668 0.016 41.730 0.000 0.668 0.668
## Alc2_f|t2 1.599 0.024 66.312 0.000 1.599 1.599
## Alc2_f|t3 1.948 0.031 62.624 0.000 1.948 1.948
## Alc2_f|t4 2.455 0.050 48.926 0.000 2.455 2.455
## Alc3_f|t1 0.748 0.016 45.785 0.000 0.748 0.748
## Alc3_f|t2 1.298 0.020 64.042 0.000 1.298 1.298
## Alc3_f|t3 1.696 0.026 65.915 0.000 1.696 1.696
## Alc3_f|t4 2.372 0.046 51.578 0.000 2.372 2.372
## Alc4_f|t1 0.510 0.015 33.017 0.000 0.510 0.510
## Alc4_f|t2 1.161 0.019 61.164 0.000 1.161 1.161
## Alc4_f|t3 1.652 0.025 66.158 0.000 1.652 1.652
## Alc4_f|t4 2.274 0.042 54.557 0.000 2.274 2.274
## Alc5_f|t1 0.587 0.016 37.409 0.000 0.587 0.587
## Alc5_f|t2 1.226 0.020 62.672 0.000 1.226 1.226
## Alc5_f|t3 1.646 0.025 66.186 0.000 1.646 1.646
## Alc5_f|t4 2.274 0.042 54.557 0.000 2.274 2.274
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## gotBully 1.000 1.000 1.000
## .alcohol 1.000 0.981 0.981
## .GotBully1_f 0.413 0.413 0.413
## .GotBully2_f 0.420 0.420 0.420
## .GotBully3_f 0.359 0.359 0.359
## .GotBully4_f 0.388 0.388 0.388
## .GotBully5_f 0.331 0.331 0.331
## .GotBully6_f 0.279 0.279 0.279
## .GotBully7_f 0.434 0.434 0.434
## .GotBully8_f 0.250 0.250 0.250
## .GotBully9_f 0.199 0.199 0.199
## .Alc1_f 0.276 0.276 0.276
## .Alc2_f 0.505 0.505 0.505
## .Alc3_f 0.105 0.105 0.105
## .Alc4_f 0.162 0.162 0.162
## .Alc5_f 0.112 0.112 0.112
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## GotBully1_f 1.000 1.000 1.000
## GotBully2_f 1.000 1.000 1.000
## GotBully3_f 1.000 1.000 1.000
## GotBully4_f 1.000 1.000 1.000
## GotBully5_f 1.000 1.000 1.000
## GotBully6_f 1.000 1.000 1.000
## GotBully7_f 1.000 1.000 1.000
## GotBully8_f 1.000 1.000 1.000
## GotBully9_f 1.000 1.000 1.000
## Alc1_f 1.000 1.000 1.000
## Alc2_f 1.000 1.000 1.000
## Alc3_f 1.000 1.000 1.000
## Alc4_f 1.000 1.000 1.000
## Alc5_f 1.000 1.000 1.000
####--------------------------------------------####
#### Section-4: A Three-Factor Structural Model ####
#### Depression as a potential Mediator between ####
#### Got Bullied and Alcohol Use ####
####--------------------------------------------####
## The Continuous Treatment (ML) of the Indirect-Effect (Mediation) Model
## The Variables for this Model Are Coded as Integers
model.indirect.con <- '
## the measurement model
gotBully =~ NA*GotBully1_i + GotBully2_i + GotBully3_i
+ GotBully4_i + GotBully5_i + GotBully6_i
+ GotBully7_i + GotBully8_i + GotBully9_i
gotBully ~~ 1*gotBully
depress =~ NA*Depress1_i + Depress2_i + Depress3_i
+ Depress4_i + Depress5_i + Depress6_i
depress ~~ 1*depress
alcohol =~ NA*Alc1_i + Alc2_i + Alc3_i + Alc4_i + Alc5_i
alcohol ~~ 1*alcohol
## the structural model
# direct effect (the c path)
alcohol ~ c*gotBully
# mediator paths (the a and b path)
depress ~ a*gotBully # the a path - IV predicting ME
alcohol ~ b*depress # the b path - ME predicting DV
# indirect effect (a*b)
# := operator defines new parameters
ab := a*b
# total effect
total := c + (a*b)
'
## verbose = FALSE will not display the bootsrap iterations on screen
fit.indirect.ML <- sem(model = model.indirect.con, data = hbsc,
mimic = "Mplus", estimator = "ML",
se = "bootstrap", verbose = TRUE, bootstrap = 10)
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be ignored:
## 7489
##
## estimation saturated H1 model -- start EM steps
## EM iteration: 0 fx = 16.0101850496
## EM iteration: 1 fx = 8.5835335721 delta par = 0.81853193
## EM iteration: 2 fx = 8.4224092506 delta par = 0.09187098
## EM iteration: 3 fx = 8.4176873525 delta par = 0.01516392
## EM iteration: 4 fx = 8.4175401891 delta par = 0.00250352
## EM iteration: 5 fx = 8.4175355743 delta par = 0.00041360
## EM iteration: 6 fx = 8.4175354274 delta par = 0.00006837
## EM iteration: 7 fx = 8.4175354226 delta par = 0.00001177
## EM iteration: 8 fx = 8.4175354224 delta par = 0.00000230
## EM iteration: 9 fx = 8.4175354224 delta par = 0.00000045
## estimated Sigma and Mu (H1):
##
## Sigma:
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1.348647785 0.6612443949 0.464785236 0.656071818 0.413377976
## [2,] 0.661244395 1.0540731421 0.374926716 0.592741274 0.323317874
## [3,] 0.464785236 0.3749267163 0.667807831 0.390818507 0.335474159
## [4,] 0.656071818 0.5927412741 0.390818507 1.146843296 0.355573103
## [5,] 0.413377976 0.3233178740 0.335474159 0.355573103 0.681063468
## [6,] 0.282707430 0.2651596330 0.275824857 0.278359218 0.335082137
## [7,] 0.567049577 0.4547644093 0.354357488 0.570825286 0.355781609
## [8,] 0.223334152 0.2323557471 0.220735999 0.261796625 0.231396007
## [9,] 0.191567821 0.1983309056 0.204406849 0.234535584 0.214200407
## [10,] -0.020158280 -0.0179378133 -0.018770091 -0.008353479 -0.026219612
## [11,] -0.047620070 -0.0265061719 -0.011467909 -0.025048300 -0.025489338
## [12,] -0.022226387 -0.0146624161 -0.001372837 -0.012654019 -0.015615102
## [13,] -0.029294269 -0.0173406483 -0.011649149 -0.028194467 -0.016149362
## [14,] -0.022120444 -0.0235671222 -0.014818349 -0.044632066 -0.008982916
## [15,] -0.005897136 -0.0099786620 -0.010899944 -0.016624002 -0.014645763
## [16,] 0.001177070 0.0044490535 0.049913610 0.050030200 0.060178240
## [17,] 0.023915105 0.0482588227 0.045424469 0.063751034 0.063246840
## [18,] -0.013198920 0.0032996108 0.038115093 0.066927946 0.047418916
## [19,] 0.002725261 0.0003768023 0.027163696 0.083386732 0.056903140
## [20,] -0.003617966 0.0039027269 0.031103428 0.071303398 0.051255218
## [,6] [,7] [,8] [,9] [,10]
## [1,] 0.2827074298 0.567049577 0.2233341519 0.191567821 -0.020158280
## [2,] 0.2651596330 0.454764409 0.2323557471 0.198330906 -0.017937813
## [3,] 0.2758248571 0.354357488 0.2207359994 0.204406849 -0.018770091
## [4,] 0.2783592179 0.570825286 0.2617966251 0.234535584 -0.008353479
## [5,] 0.3350821372 0.355781609 0.2313960072 0.214200407 -0.026219612
## [6,] 0.4741660802 0.281833806 0.2260329434 0.215881877 -0.016550413
## [7,] 0.2818338056 1.120255166 0.2481343622 0.225008134 -0.017543520
## [8,] 0.2260329434 0.248134362 0.3930871483 0.245351683 -0.005199744
## [9,] 0.2158818772 0.225008134 0.2453516834 0.346937361 -0.019282587
## [10,] -0.0165504128 -0.017543520 -0.0051997438 -0.019282587 1.240115510
## [11,] -0.0066124462 -0.019043331 0.0003112236 -0.014413632 0.614929620
## [12,] -0.0168210170 -0.006186408 -0.0057019624 -0.015989458 0.681137886
## [13,] -0.0007283239 -0.025344347 -0.0046852249 -0.015422393 0.651983626
## [14,] 0.0095146846 -0.019705481 -0.0055299280 0.001743887 0.527250969
## [15,] -0.0026171476 -0.002074906 -0.0064642431 -0.003693630 0.523132157
## [16,] 0.0442603615 0.086560249 0.0485916313 0.052072086 -0.004529692
## [17,] 0.0586844484 0.089615011 0.0571185242 0.056208890 -0.002811206
## [18,] 0.0493856991 0.090903044 0.0574493202 0.060389578 -0.010946659
## [19,] 0.0483746261 0.114071212 0.0569816049 0.057422663 0.001359820
## [20,] 0.0504321146 0.109503246 0.0592129209 0.056144375 0.008075413
## [,11] [,12] [,13] [,14] [,15]
## [1,] -0.0476200697 -0.0222263867 -0.0292942691 -0.022120444 -0.005897136
## [2,] -0.0265061719 -0.0146624161 -0.0173406483 -0.023567122 -0.009978662
## [3,] -0.0114679095 -0.0013728367 -0.0116491490 -0.014818349 -0.010899944
## [4,] -0.0250483004 -0.0126540192 -0.0281944674 -0.044632066 -0.016624002
## [5,] -0.0254893377 -0.0156151016 -0.0161493617 -0.008982916 -0.014645763
## [6,] -0.0066124462 -0.0168210170 -0.0007283239 0.009514685 -0.002617148
## [7,] -0.0190433311 -0.0061864076 -0.0253443475 -0.019705481 -0.002074906
## [8,] 0.0003112236 -0.0057019624 -0.0046852249 -0.005529928 -0.006464243
## [9,] -0.0144136317 -0.0159894580 -0.0154223930 0.001743887 -0.003693630
## [10,] 0.6149296201 0.6811378863 0.6519836263 0.527250969 0.523132157
## [11,] 1.2460079652 0.5381448059 0.5639284675 0.527031202 0.543593663
## [12,] 0.5381448059 1.4806555736 0.7002763548 0.557116572 0.643638650
## [13,] 0.5639284675 0.7002763548 1.7702796564 0.841863837 0.668673705
## [14,] 0.5270312017 0.5571165724 0.8418638374 1.846480828 0.667031260
## [15,] 0.5435936625 0.6436386505 0.6686737050 0.667031260 1.798776740
## [16,] -0.0057092056 -0.0027937279 0.0091542450 0.004144423 0.010287652
## [17,] 0.0012818862 -0.0032366840 0.0005159038 0.004622549 0.007581464
## [18,] -0.0076661063 -0.0148973627 0.0040813834 -0.005235981 -0.002243470
## [19,] 0.0065573925 0.0009764599 0.0064313755 0.002288031 0.022892343
## [20,] 0.0082487079 -0.0034238662 0.0142779906 0.002029729 0.013799987
## [,16] [,17] [,18] [,19] [,20]
## [1,] 0.001177070 0.0239151052 -0.013198920 0.0027252609 -0.003617966
## [2,] 0.004449053 0.0482588227 0.003299611 0.0003768023 0.003902727
## [3,] 0.049913610 0.0454244686 0.038115093 0.0271636958 0.031103428
## [4,] 0.050030200 0.0637510339 0.066927946 0.0833867316 0.071303398
## [5,] 0.060178240 0.0632468405 0.047418916 0.0569031398 0.051255218
## [6,] 0.044260362 0.0586844484 0.049385699 0.0483746261 0.050432115
## [7,] 0.086560249 0.0896150105 0.090903044 0.1140712124 0.109503246
## [8,] 0.048591631 0.0571185242 0.057449320 0.0569816049 0.059212921
## [9,] 0.052072086 0.0562088900 0.060389578 0.0574226627 0.056144375
## [10,] -0.004529692 -0.0028112063 -0.010946659 0.0013598196 0.008075413
## [11,] -0.005709206 0.0012818862 -0.007666106 0.0065573925 0.008248708
## [12,] -0.002793728 -0.0032366840 -0.014897363 0.0009764599 -0.003423866
## [13,] 0.009154245 0.0005159038 0.004081383 0.0064313755 0.014277991
## [14,] 0.004144423 0.0046225488 -0.005235981 0.0022880315 0.002029729
## [15,] 0.010287652 0.0075814643 -0.002243470 0.0228923428 0.013799987
## [16,] 0.600692486 0.2747954221 0.435796230 0.4208187467 0.437484620
## [17,] 0.274795422 0.4768761310 0.291767191 0.2900336240 0.305564370
## [18,] 0.435796230 0.2917671914 0.645787232 0.5233723751 0.536263647
## [19,] 0.420818747 0.2900336240 0.523372375 0.7561875171 0.568341520
## [20,] 0.437484620 0.3055643698 0.536263647 0.5683415202 0.714177222
##
## Mu:
## [1] 0.6639093 0.5130381 0.2814933 0.6088566 0.2776411 0.1889669 0.5094545
## [8] 0.1591199 0.1298735 2.5951270 2.2315175 3.1048608 2.7506438 2.4837312
## [15] 2.3752808 2.3546066 2.3268822 2.3584999 2.4686215 2.4253659
##
## estimation saturated H1 model -- end
##
## Quasi-Newton steps using NLMINB:
## Objective function = 1.2369394636385671
## Objective function = Inf
## Objective function = 1.1114621719120255
## Objective function = 0.8904262513281544
## Objective function = Inf
## Objective function = 1.5355984914003225
## Objective function = 0.8206908981440808
## Objective function = 0.7246917304603961
## Objective function = 0.6762196469390220
## Objective function = 0.5597239457339871
## Objective function = 0.8458274928391765
## Objective function = 0.5454052383944701
## Objective function = 0.5114993454624628
## Objective function = 0.5013579753533532
## Objective function = 0.4772543852832980
## Objective function = 0.4803062546886245
## Objective function = 0.4712857108391519
## Objective function = 0.4631933205011221
## Objective function = 0.4475351990961274
## Objective function = 0.4270170584534769
## Objective function = 0.4173760763594023
## Objective function = 0.3895696431122015
## Objective function = 0.4849044035586934
## Objective function = 0.3792603661456360
## Objective function = 0.3496990470089516
## Objective function = 0.4189794353833713
## Objective function = 0.3343492601984668
## Objective function = 0.3275421644749690
## Objective function = 0.3245741990539956
## Objective function = 0.3201386195945810
## Objective function = 0.3185234453248427
## Objective function = 0.3124835486741135
## Objective function = 0.3073475774833794
## Objective function = 0.3060613845439581
## Objective function = 0.3057813498127429
## Objective function = 0.3053442790109511
## Objective function = 0.3042562978855106
## Objective function = 0.3049496042039630
## Objective function = 0.3038735184470696
## Objective function = 0.3041314089508367
## Objective function = 0.3038388714351603
## Objective function = 0.3038264999696167
## Objective function = 0.3038112941432729
## Objective function = 0.3038038480452467
## Objective function = 0.3037986089248799
## Objective function = 0.3038009278393590
## Objective function = 0.3037941742007462
## Objective function = 0.3037937444523742
## Objective function = 0.3037943339261568
## Objective function = 0.3037927609799480
## Objective function = 0.3037925990722634
## Objective function = 0.3037922131067257
## Objective function = 0.3037922231474468
## Objective function = 0.3037920596484724
## Objective function = 0.3037919946021921
## Objective function = 0.3037919778380491
## Objective function = 0.3037919499176001
## Objective function = 0.3037919390166426
## Objective function = 0.3037919408153167
## Objective function = 0.3037919313379485
## Objective function = 0.3037919293624363
## Objective function = 0.3037919279045971
## Objective function = 0.3037919271861362
## Objective function = 0.3037919262435214
## Objective function = 0.3037919262988318
## Objective function = 0.3037919261366486
## Objective function = 0.3037919261072721
## Objective function = 0.3037919260840605
## Objective function = 0.3037919260837665
## Objective function = 0.3037919260837665
## convergence status (0=ok): 0
## nlminb message says: relative convergence (4)
## number of iterations: 51
## number of function evaluations [objective, gradient]: 69 52
## Computing VCOV for se = bootstrap ... ... bootstrap draw number: 1 OK -- niter = 38 fx = 0.323563670
## ... bootstrap draw number: 2 OK -- niter = 39 fx = 0.320683188
## ... bootstrap draw number: 3 OK -- niter = 39 fx = 0.285763277
## ... bootstrap draw number: 4 OK -- niter = 41 fx = 0.315717522
## ... bootstrap draw number: 5 OK -- niter = 44 fx = 0.307472990
## ... bootstrap draw number: 6 OK -- niter = 39 fx = 0.303556909
## ... bootstrap draw number: 7 OK -- niter = 43 fx = 0.306022572
## ... bootstrap draw number: 8 OK -- niter = 41 fx = 0.332700638
## ... bootstrap draw number: 9 OK -- niter = 40 fx = 0.310919412
## ... bootstrap draw number: 10 OK -- niter = 40 fx = 0.345218173
## Number of successful bootstrap draws: 10
## done.
## Computing TEST for test = standard ... done.
summary(fit.indirect.ML, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 51 iterations
##
## Used Total
## Number of observations 9226 9227
##
## Number of missing patterns 144
##
## Estimator ML
## Minimum Function Test Statistic 5605.569
## Degrees of freedom 167
## P-value (Chi-square) 0.000
##
## Model test baseline model:
##
## Minimum Function Test Statistic 70049.784
## Degrees of freedom 190
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.922
## Tucker-Lewis Index (TLI) 0.911
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -195609.297
## Loglikelihood unrestricted model (H1) -192806.513
##
## Number of free parameters 63
## Akaike (AIC) 391344.594
## Bayesian (BIC) 391793.770
## Sample-size adjusted Bayesian (BIC) 391593.566
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.059
## 90 Percent Confidence Interval 0.058 0.061
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.039
##
## Parameter Estimates:
##
## Information Observed
## Standard Errors Bootstrap
## Number of requested bootstrap draws 10
## Number of successful bootstrap draws 10
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## gotBully =~
## GotBully1_i 0.738 0.020 36.224 0.000 0.738 0.636
## GotBully2_i 0.652 0.015 43.979 0.000 0.652 0.635
## GotBully3_i 0.565 0.009 62.198 0.000 0.565 0.691
## GotBully4_i 0.711 0.010 73.024 0.000 0.711 0.664
## GotBully5_i 0.568 0.010 55.803 0.000 0.568 0.689
## GotBully6_i 0.478 0.018 26.471 0.000 0.478 0.695
## GotBully7_i 0.659 0.016 40.269 0.000 0.659 0.622
## GotBully8_i 0.415 0.015 27.458 0.000 0.415 0.664
## GotBully9_i 0.380 0.018 20.553 0.000 0.380 0.647
## depress =~
## Depress1_i 0.776 0.012 64.828 0.000 0.776 0.697
## Depress2_i 0.703 0.015 48.427 0.000 0.703 0.630
## Depress3_i 0.808 0.007 115.089 0.000 0.808 0.664
## Depress4_i 0.879 0.009 92.838 0.000 0.879 0.661
## Depress5_i 0.778 0.011 69.644 0.000 0.779 0.573
## Depress6_i 0.760 0.014 53.612 0.000 0.761 0.567
## alcohol =~
## Alc1_i 0.588 0.012 48.322 0.000 0.593 0.765
## Alc2_i 0.408 0.013 32.620 0.000 0.411 0.596
## Alc3_i 0.709 0.011 62.460 0.000 0.715 0.890
## Alc4_i 0.730 0.009 85.618 0.000 0.736 0.846
## Alc5_i 0.748 0.011 65.792 0.000 0.754 0.892
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## alcohol ~
## gotBully (c) 0.128 0.017 7.612 0.000 0.127 0.127
## depress ~
## gotBully (a) -0.032 0.008 -4.069 0.000 -0.032 -0.032
## alcohol ~
## depress (b) 0.006 0.011 0.548 0.584 0.006 0.006
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .GotBully1_i 0.660 0.011 60.623 0.000 0.660 0.568
## .GotBully2_i 0.510 0.013 39.102 0.000 0.510 0.497
## .GotBully3_i 0.280 0.007 39.411 0.000 0.280 0.343
## .GotBully4_i 0.609 0.009 66.624 0.000 0.609 0.569
## .GotBully5_i 0.278 0.006 46.982 0.000 0.278 0.337
## .GotBully6_i 0.189 0.005 35.318 0.000 0.189 0.275
## .GotBully7_i 0.512 0.009 55.766 0.000 0.512 0.484
## .GotBully8_i 0.160 0.006 27.735 0.000 0.160 0.256
## .GotBully9_i 0.131 0.005 27.903 0.000 0.131 0.223
## .Depress1_i 2.595 0.008 315.629 0.000 2.595 2.330
## .Depress2_i 2.231 0.014 159.666 0.000 2.231 1.999
## .Depress3_i 3.105 0.013 230.807 0.000 3.105 2.551
## .Depress4_i 2.751 0.013 216.225 0.000 2.751 2.067
## .Depress5_i 2.484 0.012 200.322 0.000 2.484 1.828
## .Depress6_i 2.376 0.009 276.795 0.000 2.376 1.771
## .Alc1_i 2.355 0.006 364.913 0.000 2.355 3.038
## .Alc2_i 2.327 0.007 343.750 0.000 2.327 3.370
## .Alc3_i 2.359 0.007 335.399 0.000 2.359 2.935
## .Alc4_i 2.469 0.007 357.539 0.000 2.469 2.839
## .Alc5_i 2.426 0.008 302.442 0.000 2.426 2.870
## gotBully 0.000 0.000 0.000
## .depress 0.000 0.000 0.000
## .alcohol 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## gotBully 1.000 1.000 1.000
## .depress 1.000 0.999 0.999
## .alcohol 1.000 0.984 0.984
## .GotBully1_i 0.804 0.021 37.589 0.000 0.804 0.596
## .GotBully2_i 0.629 0.021 30.464 0.000 0.629 0.597
## .GotBully3_i 0.348 0.014 24.902 0.000 0.348 0.522
## .GotBully4_i 0.640 0.023 27.769 0.000 0.640 0.559
## .GotBully5_i 0.358 0.018 20.081 0.000 0.358 0.526
## .GotBully6_i 0.244 0.013 19.254 0.000 0.244 0.516
## .GotBully7_i 0.687 0.021 31.974 0.000 0.687 0.613
## .GotBully8_i 0.219 0.010 21.895 0.000 0.219 0.560
## .GotBully9_i 0.200 0.008 26.669 0.000 0.200 0.581
## .Depress1_i 0.637 0.014 45.616 0.000 0.637 0.514
## .Depress2_i 0.752 0.012 63.271 0.000 0.752 0.603
## .Depress3_i 0.827 0.023 36.737 0.000 0.827 0.559
## .Depress4_i 0.997 0.019 52.530 0.000 0.997 0.563
## .Depress5_i 1.240 0.021 59.665 0.000 1.240 0.672
## .Depress6_i 1.220 0.028 43.874 0.000 1.220 0.678
## .Alc1_i 0.249 0.008 32.761 0.000 0.249 0.414
## .Alc2_i 0.308 0.009 35.811 0.000 0.308 0.645
## .Alc3_i 0.135 0.006 22.435 0.000 0.135 0.208
## .Alc4_i 0.215 0.012 17.710 0.000 0.215 0.284
## .Alc5_i 0.146 0.007 19.533 0.000 0.146 0.204
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ab -0.000 0.000 -0.399 0.690 -0.000 -0.000
## total 0.128 0.018 7.134 0.000 0.126 0.126
## The Categorical Treatment (DWLS) of the Indirect-Effect (Mediation) Model
## The Variables for this Model Are Coded as Factors
model.indirect.cat <- '
## the measurement model
gotBully =~ NA*GotBully1_f + GotBully2_f + GotBully3_f
+ GotBully4_f + GotBully5_f + GotBully6_f
+ GotBully7_f + GotBully8_f + GotBully9_f
gotBully ~~ 1*gotBully
depress =~ NA*Depress1_f + Depress2_f + Depress3_f
+ Depress4_f + Depress5_f + Depress6_f
depress ~~ 1*depress
alcohol =~ NA*Alc1_f + Alc2_f + Alc3_f + Alc4_f + Alc5_f
alcohol ~~ 1*alcohol
## the structural model
## direct effect (the c path)
alcohol ~ c*gotBully
## mediator paths (the a and b path)
depress ~ a*gotBully # the a path - IV predicting ME
alcohol ~ b*depress # the b path - ME predicting DV
## indirect effect (a*b)
## := operator defines new parameters
ab := a*b
## total effect
total := c + (a*b)
'
fit.indirect.DWLS <-
sem(model = model.indirect.cat, data = hbsc, mimic = "Mplus",
estimator = "DWLS", se = "bootstrap", verbose = TRUE,
bootstrap = 10,
ordered = c("GotBully1_f", "GotBully2_f", "GotBully3_f",
"GotBully4_f", "GotBully5_f", "GotBully6_f",
"GotBully7_f", "GotBully8_f", "GotBully9_f",
"Depress1_f", "Depress2_f", "Depress3_f",
"Depress4_f", "Depress5_f", "Depress6_f",
"Alc1_f", "Alc2_f", "Alc3_f", "Alc4_f", "Alc5_f"))
## Estimating sample thresholds and correlations ...
## Warning in pc_cor_TS(fit.y1 = UNI[[i]], fit.y2 = UNI[[j]], method =
## optim.method, : lavaan WARNING: empty cell(s) in bivariate table of Alc1_f
## x GotBully5_f
## Warning in pc_cor_TS(fit.y1 = UNI[[i]], fit.y2 = UNI[[j]], method =
## optim.method, : lavaan WARNING: empty cell(s) in bivariate table of Alc2_f
## x GotBully6_f
## Warning in pc_cor_TS(fit.y1 = UNI[[i]], fit.y2 = UNI[[j]], method =
## optim.method, : lavaan WARNING: empty cell(s) in bivariate table of Alc3_f
## x Alc1_f
## done
## Quasi-Newton steps using NLMINB:
## Objective function = 3.4744358632854544
## Objective function = 5.2715188376976485
## Objective function = 0.9339952795637124
## Objective function = 1.1741833689023096
## Objective function = 0.4965823898158700
## Objective function = 0.3105534612551779
## Objective function = 0.2231495606575221
## Objective function = 0.2370709720779824
## Objective function = 0.1902542238851119
## Objective function = 0.1952162422350136
## Objective function = 0.1897729257393825
## Objective function = 0.1861996616330555
## Objective function = 0.1853975415199050
## Objective function = 0.1866419404050293
## Objective function = 0.1851219740255428
## Objective function = 0.1850996320939146
## Objective function = 0.1851606317733811
## Objective function = 0.1850383775620663
## Objective function = 0.1850202796351650
## Objective function = 0.1850270548246426
## Objective function = 0.1850094994058001
## Objective function = 0.1850062243637064
## Objective function = 0.1850077079090387
## Objective function = 0.1850062602051931
## Objective function = 0.1850057917590691
## Objective function = 0.1850054005111328
## Objective function = 0.1850053224833825
## Objective function = 0.1850052644029618
## Objective function = 0.1850052944855754
## Objective function = 0.1850052416883415
## Objective function = 0.1850052281783777
## Objective function = 0.1850052336814881
## Objective function = 0.1850052244155190
## Objective function = 0.1850052239940537
## Objective function = 0.1850052237051723
## Objective function = 0.1850052235355862
## Objective function = 0.1850052233625344
## Objective function = 0.1850052234164415
## Objective function = 0.1850052233048558
## Objective function = 0.1850052232940274
## Objective function = 0.1850052232942344
## Objective function = 0.1850052232940274
## convergence status (0=ok): 0
## nlminb message says: relative convergence (4)
## number of iterations: 28
## number of function evaluations [objective, gradient]: 41 28
## Computing VCOV for se = bootstrap ... ... bootstrap draw number: 1 OK -- niter = 31 fx = 0.182878577
## ... bootstrap draw number: 2 OK -- niter = 30 fx = 0.216170672
## ... bootstrap draw number: 3 OK -- niter = 34 fx = 0.211663918
## ... bootstrap draw number: 4 OK -- niter = 32 fx = 0.218984143
## ... bootstrap draw number: 5 OK -- niter = 32 fx = 0.173710327
## ... bootstrap draw number: 6 OK -- niter = 31 fx = 0.205184150
## ... bootstrap draw number: 7 OK -- niter = 29 fx = 0.207614464
## ... bootstrap draw number: 8 OK -- niter = 27 fx = 0.197489822
## ... bootstrap draw number: 9 OK -- niter = 27 fx = 0.208924680
## ... bootstrap draw number: 10 OK -- niter = 29 fx = 0.180718442
## Number of successful bootstrap draws: 10
## done.
## Computing TEST for test = standard ... done.
summary(fit.indirect.DWLS, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 28 iterations
##
## Used Total
## Number of observations 7118 9227
##
## Estimator DWLS
## Minimum Function Test Statistic 2633.734
## Degrees of freedom 167
## P-value (Chi-square) 0.000
##
## Model test baseline model:
##
## Minimum Function Test Statistic 281854.962
## Degrees of freedom 190
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.991
## Tucker-Lewis Index (TLI) 0.990
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.046
## 90 Percent Confidence Interval 0.044 0.047
## P-value RMSEA <= 0.05 1.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.056
##
## Weighted Root Mean Square Residual:
##
## WRMR 3.123
##
## Parameter Estimates:
##
## Information Observed
## Standard Errors Bootstrap
## Number of requested bootstrap draws 10
## Number of successful bootstrap draws 10
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## gotBully =~
## GotBully1_f 0.770 0.012 63.455 0.000 0.770 0.770
## GotBully2_f 0.768 0.012 66.381 0.000 0.768 0.768
## GotBully3_f 0.788 0.016 50.203 0.000 0.788 0.788
## GotBully4_f 0.798 0.007 108.918 0.000 0.798 0.798
## GotBully5_f 0.811 0.011 77.005 0.000 0.811 0.811
## GotBully6_f 0.833 0.011 73.890 0.000 0.833 0.833
## GotBully7_f 0.770 0.012 65.382 0.000 0.770 0.770
## GotBully8_f 0.858 0.015 55.738 0.000 0.858 0.858
## GotBully9_f 0.883 0.019 46.673 0.000 0.883 0.883
## depress =~
## Depress1_f 0.675 0.011 61.857 0.000 0.735 0.735
## Depress2_f 0.606 0.013 47.642 0.000 0.659 0.659
## Depress3_f 0.695 0.010 66.699 0.000 0.756 0.756
## Depress4_f 0.663 0.011 57.899 0.000 0.721 0.721
## Depress5_f 0.583 0.012 50.001 0.000 0.634 0.634
## Depress6_f 0.582 0.008 68.869 0.000 0.633 0.633
## alcohol =~
## Alc1_f 0.806 0.009 91.343 0.000 0.847 0.847
## Alc2_f 0.667 0.017 38.288 0.000 0.701 0.701
## Alc3_f 0.900 0.004 214.320 0.000 0.946 0.946
## Alc4_f 0.871 0.007 119.178 0.000 0.916 0.916
## Alc5_f 0.897 0.005 167.267 0.000 0.943 0.943
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## alcohol ~
## gotBully (c) 0.014 0.027 0.532 0.594 0.014 0.014
## depress ~
## gotBully (a) 0.428 0.022 19.572 0.000 0.394 0.394
## alcohol ~
## depress (b) 0.292 0.019 15.292 0.000 0.302 0.302
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .GotBully1_f 0.000 0.000 0.000
## .GotBully2_f 0.000 0.000 0.000
## .GotBully3_f 0.000 0.000 0.000
## .GotBully4_f 0.000 0.000 0.000
## .GotBully5_f 0.000 0.000 0.000
## .GotBully6_f 0.000 0.000 0.000
## .GotBully7_f 0.000 0.000 0.000
## .GotBully8_f 0.000 0.000 0.000
## .GotBully9_f 0.000 0.000 0.000
## .Depress1_f 0.000 0.000 0.000
## .Depress2_f 0.000 0.000 0.000
## .Depress3_f 0.000 0.000 0.000
## .Depress4_f 0.000 0.000 0.000
## .Depress5_f 0.000 0.000 0.000
## .Depress6_f 0.000 0.000 0.000
## .Alc1_f 0.000 0.000 0.000
## .Alc2_f 0.000 0.000 0.000
## .Alc3_f 0.000 0.000 0.000
## .Alc4_f 0.000 0.000 0.000
## .Alc5_f 0.000 0.000 0.000
## gotBully 0.000 0.000 0.000
## .depress 0.000 0.000 0.000
## .alcohol 0.000 0.000 0.000
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## GotBully1_f|t1 0.435 0.015 29.086 0.000 0.435 0.435
## GotBully1_f|t2 1.046 0.018 58.550 0.000 1.046 1.046
## GotBully1_f|t3 1.262 0.022 57.812 0.000 1.262 1.262
## GotBully1_f|t4 1.528 0.020 75.165 0.000 1.528 1.528
## GotBully2_f|t1 0.618 0.013 46.304 0.000 0.618 0.618
## GotBully2_f|t2 1.198 0.017 69.725 0.000 1.198 1.198
## GotBully2_f|t3 1.422 0.030 48.169 0.000 1.422 1.422
## GotBully2_f|t4 1.736 0.037 46.586 0.000 1.736 1.736
## GotBully3_f|t1 1.088 0.010 112.983 0.000 1.088 1.088
## GotBully3_f|t2 1.518 0.017 90.037 0.000 1.518 1.518
## GotBully3_f|t3 1.734 0.024 73.454 0.000 1.734 1.734
## GotBully3_f|t4 1.987 0.045 43.913 0.000 1.987 1.987
## GotBully4_f|t1 0.425 0.016 26.647 0.000 0.425 0.425
## GotBully4_f|t2 1.111 0.021 53.522 0.000 1.111 1.111
## GotBully4_f|t3 1.399 0.015 92.414 0.000 1.399 1.399
## GotBully4_f|t4 1.664 0.024 70.290 0.000 1.664 1.664
## GotBully5_f|t1 1.119 0.015 72.627 0.000 1.119 1.119
## GotBully5_f|t2 1.520 0.023 66.549 0.000 1.520 1.520
## GotBully5_f|t3 1.711 0.025 67.332 0.000 1.711 1.711
## GotBully5_f|t4 1.965 0.034 57.182 0.000 1.965 1.965
## GotBully6_f|t1 1.340 0.019 69.151 0.000 1.340 1.340
## GotBully6_f|t2 1.696 0.025 67.799 0.000 1.696 1.696
## GotBully6_f|t3 1.890 0.031 61.337 0.000 1.890 1.890
## GotBully6_f|t4 2.134 0.043 50.142 0.000 2.134 2.134
## GotBully7_f|t1 0.677 0.015 45.133 0.000 0.677 0.677
## GotBully7_f|t2 1.155 0.022 53.115 0.000 1.155 1.155
## GotBully7_f|t3 1.405 0.023 62.438 0.000 1.405 1.405
## GotBully7_f|t4 1.696 0.027 61.945 0.000 1.696 1.696
## GotBully8_f|t1 1.404 0.019 73.617 0.000 1.404 1.404
## GotBully8_f|t2 1.800 0.029 61.640 0.000 1.800 1.800
## GotBully8_f|t3 2.027 0.035 57.823 0.000 2.027 2.027
## GotBully8_f|t4 2.237 0.049 45.349 0.000 2.237 2.237
## GotBully9_f|t1 1.544 0.027 57.875 0.000 1.544 1.544
## GotBully9_f|t2 1.878 0.036 51.763 0.000 1.878 1.878
## GotBully9_f|t3 2.058 0.031 66.164 0.000 2.058 2.058
## GotBully9_f|t4 2.241 0.043 52.205 0.000 2.241 2.241
## Depress1_f|t1 -0.666 0.018 -36.981 0.000 -0.666 -0.666
## Depress1_f|t2 0.095 0.013 7.098 0.000 0.095 0.095
## Depress1_f|t3 1.004 0.016 64.308 0.000 1.004 1.004
## Depress1_f|t4 1.723 0.024 72.520 0.000 1.723 1.723
## Depress2_f|t1 -1.046 0.013 -78.910 0.000 -1.046 -1.046
## Depress2_f|t2 -0.295 0.013 -22.755 0.000 -0.295 -0.295
## Depress2_f|t3 0.688 0.011 65.060 0.000 0.688 0.688
## Depress2_f|t4 1.532 0.025 62.112 0.000 1.532 1.532
## Depress3_f|t1 0.142 0.023 6.281 0.000 0.142 0.142
## Depress3_f|t2 0.607 0.023 26.224 0.000 0.607 0.607
## Depress3_f|t3 1.137 0.018 61.763 0.000 1.137 1.137
## Depress3_f|t4 1.612 0.023 70.325 0.000 1.612 1.612
## Depress4_f|t1 -0.174 0.017 -10.246 0.000 -0.174 -0.174
## Depress4_f|t2 0.228 0.023 9.923 0.000 0.228 0.228
## Depress4_f|t3 0.841 0.018 47.943 0.000 0.841 0.841
## Depress4_f|t4 1.433 0.023 61.536 0.000 1.433 1.433
## Depress5_f|t1 -0.456 0.022 -21.033 0.000 -0.456 -0.456
## Depress5_f|t2 0.033 0.016 2.069 0.039 0.033 0.033
## Depress5_f|t3 0.665 0.014 46.007 0.000 0.665 0.665
## Depress5_f|t4 1.248 0.016 76.414 0.000 1.248 1.248
## Depress6_f|t1 -0.618 0.019 -31.798 0.000 -0.618 -0.618
## Depress6_f|t2 -0.055 0.013 -4.228 0.000 -0.055 -0.055
## Depress6_f|t3 0.618 0.011 54.540 0.000 0.618 0.618
## Depress6_f|t4 1.179 0.014 86.694 0.000 1.179 1.179
## Alc1_f|t1 0.699 0.011 63.940 0.000 0.699 0.699
## Alc1_f|t2 1.384 0.020 67.612 0.000 1.384 1.384
## Alc1_f|t3 1.745 0.020 85.877 0.000 1.745 1.745
## Alc1_f|t4 2.396 0.038 62.680 0.000 2.396 2.396
## Alc2_f|t1 0.668 0.019 36.049 0.000 0.668 0.668
## Alc2_f|t2 1.601 0.026 62.633 0.000 1.601 1.601
## Alc2_f|t3 1.955 0.024 79.866 0.000 1.955 1.955
## Alc2_f|t4 2.478 0.061 40.401 0.000 2.478 2.478
## Alc3_f|t1 0.746 0.017 44.984 0.000 0.746 0.746
## Alc3_f|t2 1.297 0.012 103.942 0.000 1.297 1.297
## Alc3_f|t3 1.696 0.022 76.934 0.000 1.696 1.696
## Alc3_f|t4 2.384 0.049 49.132 0.000 2.384 2.384
## Alc4_f|t1 0.507 0.013 40.009 0.000 0.507 0.507
## Alc4_f|t2 1.159 0.013 88.145 0.000 1.159 1.159
## Alc4_f|t3 1.653 0.019 89.039 0.000 1.653 1.653
## Alc4_f|t4 2.292 0.035 65.058 0.000 2.292 2.292
## Alc5_f|t1 0.585 0.016 35.871 0.000 0.585 0.585
## Alc5_f|t2 1.225 0.013 96.120 0.000 1.225 1.225
## Alc5_f|t3 1.645 0.018 89.975 0.000 1.645 1.645
## Alc5_f|t4 2.282 0.028 81.501 0.000 2.282 2.282
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## gotBully 1.000 1.000 1.000
## .depress 1.000 0.845 0.845
## .alcohol 1.000 0.905 0.905
## .GotBully1_f 0.407 0.407 0.407
## .GotBully2_f 0.411 0.411 0.411
## .GotBully3_f 0.380 0.380 0.380
## .GotBully4_f 0.363 0.363 0.363
## .GotBully5_f 0.342 0.342 0.342
## .GotBully6_f 0.306 0.306 0.306
## .GotBully7_f 0.406 0.406 0.406
## .GotBully8_f 0.264 0.264 0.264
## .GotBully9_f 0.221 0.221 0.221
## .Depress1_f 0.460 0.460 0.460
## .Depress2_f 0.565 0.565 0.565
## .Depress3_f 0.428 0.428 0.428
## .Depress4_f 0.480 0.480 0.480
## .Depress5_f 0.598 0.598 0.598
## .Depress6_f 0.599 0.599 0.599
## .Alc1_f 0.282 0.282 0.282
## .Alc2_f 0.509 0.509 0.509
## .Alc3_f 0.106 0.106 0.106
## .Alc4_f 0.161 0.161 0.161
## .Alc5_f 0.110 0.110 0.110
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## GotBully1_f 1.000 1.000 1.000
## GotBully2_f 1.000 1.000 1.000
## GotBully3_f 1.000 1.000 1.000
## GotBully4_f 1.000 1.000 1.000
## GotBully5_f 1.000 1.000 1.000
## GotBully6_f 1.000 1.000 1.000
## GotBully7_f 1.000 1.000 1.000
## GotBully8_f 1.000 1.000 1.000
## GotBully9_f 1.000 1.000 1.000
## Depress1_f 1.000 1.000 1.000
## Depress2_f 1.000 1.000 1.000
## Depress3_f 1.000 1.000 1.000
## Depress4_f 1.000 1.000 1.000
## Depress5_f 1.000 1.000 1.000
## Depress6_f 1.000 1.000 1.000
## Alc1_f 1.000 1.000 1.000
## Alc2_f 1.000 1.000 1.000
## Alc3_f 1.000 1.000 1.000
## Alc4_f 1.000 1.000 1.000
## Alc5_f 1.000 1.000 1.000
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ab 0.125 0.010 11.968 0.000 0.119 0.119
## total 0.139 0.020 7.119 0.000 0.133 0.133
####-------------------------------------------------------------####
#### Section-5: One- Factort Two-Group Measurement Invariance ####
#### A One-Factor (Depression) CFA Model between Grade 6 and 7 ####
####-------------------------------------------------------------####
## Creating a Dataset only Containing Observations from Grade 6 and 7
dat.inva <- hbsc[hbsc$Grade %in% c("Grade_6", "Grade_7"), ]
dim(dat.inva)
## [1] 4284 90
## The Continous Treatment (ML) of the Items Coded as Interger Variables
## 1. Configural Invariance Test (ML)
model.config.ML <- '
depress =~ Depress1_i + Depress2_i + Depress3_i + Depress4_i
+ Depress5_i + Depress6_i
'
fit.config.ML <- cfa(model = model.config.ML, data = dat.inva,
mimic = "Mplus", estimator = "ML",
std.lv = TRUE, group = "Grade")
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be ignored:
## 49 52 132 202 251 354 415 456 634 637 670 688 713 811 1027 1099 1176 1187 1208 1545 1553 1579 1601 1653 1665 1747 1792 1806 1845
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be ignored:
## 22 105 115 216 232 291 343 369 836 858 1038 1082 1085 1129 1144 1147 1185 1275 1316 1322 1328 1397 1406 1706 1722 1806 1860 1879 1906 1907 2013 2089 2106 2127 2291 2379
summary(fit.config.ML, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 28 iterations
##
## Used Total
## Number of observations per group
## Grade_7 1851 1880
## Grade_6 2368 2404
##
## Number of missing patterns per group
## Grade_7 11
## Grade_6 17
##
## Estimator ML
## Minimum Function Test Statistic 268.115
## Degrees of freedom 29
## P-value (Chi-square) 0.000
##
## Chi-square for each group:
##
## Grade_7 113.963
## Grade_6 154.152
##
## Model test baseline model:
##
## Minimum Function Test Statistic 6441.145
## Degrees of freedom 30
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.963
## Tucker-Lewis Index (TLI) 0.961
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -38132.707
## Loglikelihood unrestricted model (H1) -37998.649
##
## Number of free parameters 25
## Akaike (AIC) 76315.413
## Bayesian (BIC) 76474.097
## Sample-size adjusted Bayesian (BIC) 76394.658
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.063
## 90 Percent Confidence Interval 0.056 0.069
## P-value RMSEA <= 0.05 0.001
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.033
##
## Parameter Estimates:
##
## Information Observed
## Standard Errors Standard
##
##
## Group 1 [Grade_7]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress =~
## Dprss1_ (.p1.) 0.783 0.017 46.428 0.000 0.783 0.701
## Dprss2_ (.p2.) 0.696 0.017 40.458 0.000 0.696 0.621
## Dprss3_ (.p3.) 0.801 0.019 42.881 0.000 0.801 0.662
## Dprss4_ (.p4.) 0.889 0.020 43.620 0.000 0.889 0.664
## Dprss5_ (.p5.) 0.781 0.021 36.345 0.000 0.781 0.580
## Dprss6_ (.p6.) 0.756 0.021 35.681 0.000 0.756 0.574
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Dprss1_ (.14.) 2.568 0.023 111.811 0.000 2.568 2.299
## .Dprss2_ (.15.) 2.207 0.022 100.879 0.000 2.207 1.968
## .Dprss3_ (.16.) 3.098 0.024 127.152 0.000 3.098 2.563
## .Dprss4_ (.17.) 2.727 0.027 101.467 0.000 2.727 2.037
## .Dprss5_ (.18.) 2.493 0.026 96.404 0.000 2.493 1.850
## .Dprss6_ (.19.) 2.362 0.025 93.399 0.000 2.362 1.795
## depress 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Depress1_i 0.635 0.027 23.751 0.000 0.635 0.509
## .Depress2_i 0.772 0.029 26.205 0.000 0.772 0.614
## .Depress3_i 0.820 0.033 24.970 0.000 0.820 0.561
## .Depress4_i 1.003 0.040 25.028 0.000 1.003 0.559
## .Depress5_i 1.205 0.045 26.807 0.000 1.205 0.664
## .Depress6_i 1.160 0.043 26.933 0.000 1.160 0.670
## depress 1.000 1.000 1.000
##
##
## Group 2 [Grade_6]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress =~
## Dprss1_ (.p1.) 0.783 0.017 46.428 0.000 0.783 0.700
## Dprss2_ (.p2.) 0.696 0.017 40.458 0.000 0.696 0.629
## Dprss3_ (.p3.) 0.801 0.019 42.881 0.000 0.801 0.651
## Dprss4_ (.p4.) 0.889 0.020 43.620 0.000 0.889 0.670
## Dprss5_ (.p5.) 0.781 0.021 36.345 0.000 0.781 0.572
## Dprss6_ (.p6.) 0.756 0.021 35.681 0.000 0.756 0.555
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Dprss1_ (.14.) 2.568 0.023 111.811 0.000 2.568 2.297
## .Dprss2_ (.15.) 2.207 0.022 100.879 0.000 2.207 1.994
## .Dprss3_ (.16.) 3.098 0.024 127.152 0.000 3.098 2.518
## .Dprss4_ (.17.) 2.727 0.027 101.467 0.000 2.727 2.056
## .Dprss5_ (.18.) 2.493 0.026 96.404 0.000 2.493 1.825
## .Dprss6_ (.19.) 2.362 0.025 93.399 0.000 2.362 1.733
## depress 0.014 0.035 0.391 0.696 0.014 0.014
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Depress1_i 0.638 0.024 26.639 0.000 0.638 0.510
## .Depress2_i 0.740 0.025 29.102 0.000 0.740 0.604
## .Depress3_i 0.873 0.030 28.629 0.000 0.873 0.577
## .Depress4_i 0.969 0.035 27.577 0.000 0.969 0.551
## .Depress5_i 1.256 0.041 30.302 0.000 1.256 0.673
## .Depress6_i 1.285 0.042 30.949 0.000 1.285 0.692
## depress 1.000 1.000 1.000
## 2. Metric (Weak) Invariance Test (ML)
model.metric.ML <-'
depress =~ Depress1_i + Depress2_i + Depress3_i + Depress4_i
+ Depress5_i + Depress6_i
depress ~~ c(1, NA)*depress'
fit.metric.ML <- cfa(model = model.config.ML, data = dat.inva,
mimic = "Mplus", estimator = "ML",
std.lv = TRUE, group = "Grade",
group.equal = "loadings")
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be ignored:
## 49 52 132 202 251 354 415 456 634 637 670 688 713 811 1027 1099 1176 1187 1208 1545 1553 1579 1601 1653 1665 1747 1792 1806 1845
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be ignored:
## 22 105 115 216 232 291 343 369 836 858 1038 1082 1085 1129 1144 1147 1185 1275 1316 1322 1328 1397 1406 1706 1722 1806 1860 1879 1906 1907 2013 2089 2106 2127 2291 2379
summary(fit.metric.ML, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 32 iterations
##
## Used Total
## Number of observations per group
## Grade_7 1851 1880
## Grade_6 2368 2404
##
## Number of missing patterns per group
## Grade_7 11
## Grade_6 17
##
## Estimator ML
## Minimum Function Test Statistic 265.787
## Degrees of freedom 24
## P-value (Chi-square) 0.000
##
## Chi-square for each group:
##
## Grade_7 112.708
## Grade_6 153.079
##
## Model test baseline model:
##
## Minimum Function Test Statistic 6441.145
## Degrees of freedom 30
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.962
## Tucker-Lewis Index (TLI) 0.953
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -38131.543
## Loglikelihood unrestricted model (H1) -37998.649
##
## Number of free parameters 30
## Akaike (AIC) 76323.085
## Bayesian (BIC) 76513.506
## Sample-size adjusted Bayesian (BIC) 76418.178
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.069
## 90 Percent Confidence Interval 0.062 0.077
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.032
##
## Parameter Estimates:
##
## Information Observed
## Standard Errors Standard
##
##
## Group 1 [Grade_7]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress =~
## Dprss1_ (.p1.) 0.783 0.017 46.426 0.000 0.783 0.701
## Dprss2_ (.p2.) 0.696 0.017 40.460 0.000 0.696 0.621
## Dprss3_ (.p3.) 0.801 0.019 42.882 0.000 0.801 0.662
## Dprss4_ (.p4.) 0.889 0.020 43.629 0.000 0.889 0.664
## Dprss5_ (.p5.) 0.782 0.021 36.353 0.000 0.782 0.580
## Dprss6_ (.p6.) 0.756 0.021 35.678 0.000 0.756 0.574
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Depress1_i 2.567 0.026 98.817 0.000 2.567 2.298
## .Depress2_i 2.213 0.026 84.847 0.000 2.213 1.973
## .Depress3_i 3.082 0.028 109.603 0.000 3.082 2.551
## .Depress4_i 2.739 0.031 87.749 0.000 2.739 2.045
## .Depress5_i 2.506 0.031 79.703 0.000 2.506 1.859
## .Depress6_i 2.352 0.031 76.764 0.000 2.352 1.788
## depress 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Depress1_i 0.635 0.027 23.753 0.000 0.635 0.509
## .Depress2_i 0.772 0.029 26.205 0.000 0.772 0.614
## .Depress3_i 0.820 0.033 24.974 0.000 0.820 0.561
## .Depress4_i 1.003 0.040 25.027 0.000 1.003 0.559
## .Depress5_i 1.205 0.045 26.808 0.000 1.205 0.664
## .Depress6_i 1.160 0.043 26.935 0.000 1.160 0.670
## depress 1.000 1.000 1.000
##
##
## Group 2 [Grade_6]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress =~
## Dprss1_ (.p1.) 0.783 0.017 46.426 0.000 0.783 0.700
## Dprss2_ (.p2.) 0.696 0.017 40.460 0.000 0.696 0.629
## Dprss3_ (.p3.) 0.801 0.019 42.882 0.000 0.801 0.651
## Dprss4_ (.p4.) 0.889 0.020 43.629 0.000 0.889 0.670
## Dprss5_ (.p5.) 0.782 0.021 36.353 0.000 0.782 0.572
## Dprss6_ (.p6.) 0.756 0.021 35.678 0.000 0.756 0.555
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Depress1_i 2.580 0.023 112.171 0.000 2.580 2.307
## .Depress2_i 2.212 0.023 97.047 0.000 2.212 1.998
## .Depress3_i 3.122 0.025 123.223 0.000 3.122 2.537
## .Depress4_i 2.731 0.027 99.954 0.000 2.731 2.059
## .Depress5_i 2.493 0.028 88.596 0.000 2.493 1.825
## .Depress6_i 2.381 0.028 84.920 0.000 2.381 1.747
## depress 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Depress1_i 0.638 0.024 26.641 0.000 0.638 0.510
## .Depress2_i 0.740 0.025 29.102 0.000 0.740 0.604
## .Depress3_i 0.873 0.030 28.633 0.000 0.873 0.577
## .Depress4_i 0.969 0.035 27.577 0.000 0.969 0.551
## .Depress5_i 1.255 0.041 30.303 0.000 1.255 0.673
## .Depress6_i 1.285 0.042 30.951 0.000 1.285 0.692
## depress 1.000 1.000 1.000
lavTestLRT(fit.config.ML, fit.metric.ML)
## Chi Square Difference Test
##
## Df AIC BIC Chisq Chisq diff Df diff Pr(>Chisq)
## fit.metric.ML 24 76323 76514 265.79
## fit.config.ML 29 76315 76474 268.11 2.3283 5 0.8021
## 3. Scalar (Strong) Invariance Test (ML)
model.scalar.ML <- '
depress =~ Depress1_i + Depress2_i + Depress3_i + Depress4_i
+ Depress5_i + Depress6_i
depress ~~ (1, NA)*depress
depress ~ c(0, NA)*1
'
fit.scalar.ML <- cfa(model = model.config.ML, data = dat.inva,
mimic = "Mplus", estimator = "ML",
std.lv = TRUE, group = "Grade",
group.equal = c("loadings", "intercepts"))
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be ignored:
## 49 52 132 202 251 354 415 456 634 637 670 688 713 811 1027 1099 1176 1187 1208 1545 1553 1579 1601 1653 1665 1747 1792 1806 1845
## Warning in lav_data_full(data = data, group = group, group.label = group.label, : lavaan WARNING: some cases are empty and will be ignored:
## 22 105 115 216 232 291 343 369 836 858 1038 1082 1085 1129 1144 1147 1185 1275 1316 1322 1328 1397 1406 1706 1722 1806 1860 1879 1906 1907 2013 2089 2106 2127 2291 2379
summary(fit.scalar.ML, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 28 iterations
##
## Used Total
## Number of observations per group
## Grade_7 1851 1880
## Grade_6 2368 2404
##
## Number of missing patterns per group
## Grade_7 11
## Grade_6 17
##
## Estimator ML
## Minimum Function Test Statistic 268.115
## Degrees of freedom 29
## P-value (Chi-square) 0.000
##
## Chi-square for each group:
##
## Grade_7 113.963
## Grade_6 154.152
##
## Model test baseline model:
##
## Minimum Function Test Statistic 6441.145
## Degrees of freedom 30
## P-value 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.963
## Tucker-Lewis Index (TLI) 0.961
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -38132.707
## Loglikelihood unrestricted model (H1) -37998.649
##
## Number of free parameters 25
## Akaike (AIC) 76315.413
## Bayesian (BIC) 76474.097
## Sample-size adjusted Bayesian (BIC) 76394.658
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.063
## 90 Percent Confidence Interval 0.056 0.069
## P-value RMSEA <= 0.05 0.001
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.033
##
## Parameter Estimates:
##
## Information Observed
## Standard Errors Standard
##
##
## Group 1 [Grade_7]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress =~
## Dprss1_ (.p1.) 0.783 0.017 46.428 0.000 0.783 0.701
## Dprss2_ (.p2.) 0.696 0.017 40.458 0.000 0.696 0.621
## Dprss3_ (.p3.) 0.801 0.019 42.881 0.000 0.801 0.662
## Dprss4_ (.p4.) 0.889 0.020 43.620 0.000 0.889 0.664
## Dprss5_ (.p5.) 0.781 0.021 36.345 0.000 0.781 0.580
## Dprss6_ (.p6.) 0.756 0.021 35.681 0.000 0.756 0.574
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Dprss1_ (.14.) 2.568 0.023 111.811 0.000 2.568 2.299
## .Dprss2_ (.15.) 2.207 0.022 100.879 0.000 2.207 1.968
## .Dprss3_ (.16.) 3.098 0.024 127.152 0.000 3.098 2.563
## .Dprss4_ (.17.) 2.727 0.027 101.467 0.000 2.727 2.037
## .Dprss5_ (.18.) 2.493 0.026 96.404 0.000 2.493 1.850
## .Dprss6_ (.19.) 2.362 0.025 93.399 0.000 2.362 1.795
## depress 0.000 0.000 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Depress1_i 0.635 0.027 23.751 0.000 0.635 0.509
## .Depress2_i 0.772 0.029 26.205 0.000 0.772 0.614
## .Depress3_i 0.820 0.033 24.970 0.000 0.820 0.561
## .Depress4_i 1.003 0.040 25.028 0.000 1.003 0.559
## .Depress5_i 1.205 0.045 26.807 0.000 1.205 0.664
## .Depress6_i 1.160 0.043 26.933 0.000 1.160 0.670
## depress 1.000 1.000 1.000
##
##
## Group 2 [Grade_6]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress =~
## Dprss1_ (.p1.) 0.783 0.017 46.428 0.000 0.783 0.700
## Dprss2_ (.p2.) 0.696 0.017 40.458 0.000 0.696 0.629
## Dprss3_ (.p3.) 0.801 0.019 42.881 0.000 0.801 0.651
## Dprss4_ (.p4.) 0.889 0.020 43.620 0.000 0.889 0.670
## Dprss5_ (.p5.) 0.781 0.021 36.345 0.000 0.781 0.572
## Dprss6_ (.p6.) 0.756 0.021 35.681 0.000 0.756 0.555
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Dprss1_ (.14.) 2.568 0.023 111.811 0.000 2.568 2.297
## .Dprss2_ (.15.) 2.207 0.022 100.879 0.000 2.207 1.994
## .Dprss3_ (.16.) 3.098 0.024 127.152 0.000 3.098 2.518
## .Dprss4_ (.17.) 2.727 0.027 101.467 0.000 2.727 2.056
## .Dprss5_ (.18.) 2.493 0.026 96.404 0.000 2.493 1.825
## .Dprss6_ (.19.) 2.362 0.025 93.399 0.000 2.362 1.733
## depress 0.014 0.035 0.391 0.696 0.014 0.014
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Depress1_i 0.638 0.024 26.639 0.000 0.638 0.510
## .Depress2_i 0.740 0.025 29.102 0.000 0.740 0.604
## .Depress3_i 0.873 0.030 28.629 0.000 0.873 0.577
## .Depress4_i 0.969 0.035 27.577 0.000 0.969 0.551
## .Depress5_i 1.256 0.041 30.302 0.000 1.256 0.673
## .Depress6_i 1.285 0.042 30.949 0.000 1.285 0.692
## depress 1.000 1.000 1.000
lavTestLRT(fit.metric.ML, fit.scalar.ML)
## Chi Square Difference Test
##
## Df AIC BIC Chisq Chisq diff Df diff Pr(>Chisq)
## fit.metric.ML 24 76323 76514 265.79
## fit.scalar.ML 29 76315 76474 268.11 2.3283 5 0.8021
## The Categorical Treatment (WLSMV) of the Items Coded as Factor Variables
## 1. Configural Invariance Test (WLSMV)
model.config.WLSMV <- '
depress =~ Depress1_f + Depress2_f + Depress3_f
+ Depress4_f + Depress5_f + Depress6_f
'
fit.config.WLSMV <- cfa(model = model.config.WLSMV, data = dat.inva,
mimic = "Mplus", estimator = "WLSMV",
std.lv = TRUE, group = "Grade",
ordered = c("Depress1_f", "Depress2_f",
"Depress3_f", "Depress4_f",
"Depress5_f", "Depress6_f"))
summary(fit.config.WLSMV, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 22 iterations
##
## Used Total
## Number of observations per group
## Grade_7 1811 1880
## Grade_6 2292 2404
##
## Estimator DWLS Robust
## Minimum Function Test Statistic 210.489 276.702
## Degrees of freedom 41 41
## P-value (Chi-square) 0.000 0.000
## Scaling correction factor 0.764
## Shift parameter for each group:
## Grade_7 0.600
## Grade_6 0.760
## for simple second-order correction (WLSMV)
##
## Chi-square for each group:
##
## Grade_7 85.291 112.170
## Grade_6 125.198 164.532
##
## Model test baseline model:
##
## Minimum Function Test Statistic 16164.928 11074.106
## Degrees of freedom 30 30
## P-value 0.000 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.989 0.979
## Tucker-Lewis Index (TLI) 0.992 0.984
##
## Robust Comparative Fit Index (CFI) NA
## Robust Tucker-Lewis Index (TLI) NA
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.045 0.053
## 90 Percent Confidence Interval 0.039 0.051 0.047 0.059
## P-value RMSEA <= 0.05 0.914 0.198
##
## Robust RMSEA NA
## 90 Percent Confidence Interval NA NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.036 0.036
##
## Weighted Root Mean Square Residual:
##
## WRMR 2.323 2.323
##
## Parameter Estimates:
##
## Information Expected
## Standard Errors Robust.sem
##
##
## Group 1 [Grade_7]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress =~
## Dprss1_ (.p1.) 0.706 0.012 57.211 0.000 0.706 0.706
## Dprss2_ (.p2.) 0.662 0.013 52.099 0.000 0.662 0.662
## Dprss3_ (.p3.) 0.764 0.014 54.299 0.000 0.764 0.764
## Dprss4_ (.p4.) 0.734 0.013 54.902 0.000 0.734 0.734
## Dprss5_ (.p5.) 0.611 0.015 40.407 0.000 0.611 0.611
## Dprss6_ (.p6.) 0.602 0.015 41.143 0.000 0.602 0.602
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Depress1_f 0.000 0.000 0.000
## .Depress2_f 0.000 0.000 0.000
## .Depress3_f 0.000 0.000 0.000
## .Depress4_f 0.000 0.000 0.000
## .Depress5_f 0.000 0.000 0.000
## .Depress6_f 0.000 0.000 0.000
## depress 0.000 0.000 0.000
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Dpr1_|1 (.p7.) -0.565 0.026 -21.510 0.000 -0.565 -0.565
## Dpr1_|2 (.p8.) 0.126 0.024 5.190 0.000 0.126 0.126
## Dpr1_|3 (.p9.) 1.082 0.030 36.172 0.000 1.082 1.082
## Dpr1_|4 (.10.) 1.768 0.042 42.022 0.000 1.768 1.768
## Dpr2_|1 (.11.) -0.886 0.028 -31.287 0.000 -0.886 -0.886
## Dpr2_|2 (.12.) -0.201 0.024 -8.287 0.000 -0.201 -0.201
## Dpr2_|3 (.13.) 0.741 0.026 27.969 0.000 0.741 0.741
## Dpr2_|4 (.14.) 1.523 0.036 41.830 0.000 1.523 1.523
## Dpr3_|1 (.15.) 0.290 0.025 11.450 0.000 0.290 0.290
## Dpr3_|2 (.16.) 0.679 0.027 25.325 0.000 0.679 0.679
## Dpr3_|3 (.17.) 1.200 0.032 37.683 0.000 1.200 1.200
## Dpr3_|4 (.18.) 1.658 0.040 41.070 0.000 1.658 1.658
## Dpr4_|1 (.19.) -0.115 0.025 -4.549 0.000 -0.115 -0.115
## Dpr4_|2 (.20.) 0.257 0.025 10.198 0.000 0.257 0.257
## Dpr4_|3 (.21.) 0.907 0.028 31.921 0.000 0.907 0.907
## Dpr4_|4 (.22.) 1.470 0.036 40.633 0.000 1.470 1.470
## Dpr5_|1 (.23.) -0.380 0.025 -15.342 0.000 -0.380 -0.380
## Dpr5_|2 (.24.) 0.068 0.023 2.926 0.003 0.068 0.068
## Dpr5_|3 (.25.) 0.675 0.026 25.926 0.000 0.675 0.675
## Dpr5_|4 (.26.) 1.246 0.033 37.568 0.000 1.246 1.246
## Dpr6_|1 (.27.) -0.442 0.025 -17.621 0.000 -0.442 -0.442
## Dpr6_|2 (.28.) 0.082 0.023 3.477 0.001 0.082 0.082
## Dpr6_|3 (.29.) 0.750 0.027 28.107 0.000 0.750 0.750
## Dpr6_|4 (.30.) 1.273 0.033 38.449 0.000 1.273 1.273
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Depress1_f 0.501 0.501 0.501
## .Depress2_f 0.562 0.562 0.562
## .Depress3_f 0.416 0.416 0.416
## .Depress4_f 0.461 0.461 0.461
## .Depress5_f 0.627 0.627 0.627
## .Depress6_f 0.638 0.638 0.638
## depress 1.000 1.000 1.000
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Depress1_f 1.000 1.000 1.000
## Depress2_f 1.000 1.000 1.000
## Depress3_f 1.000 1.000 1.000
## Depress4_f 1.000 1.000 1.000
## Depress5_f 1.000 1.000 1.000
## Depress6_f 1.000 1.000 1.000
##
##
## Group 2 [Grade_6]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress =~
## Dprss1_ (.p1.) 0.706 0.012 57.211 0.000 0.706 0.715
## Dprss2_ (.p2.) 0.662 0.013 52.099 0.000 0.662 0.648
## Dprss3_ (.p3.) 0.764 0.014 54.299 0.000 0.764 0.732
## Dprss4_ (.p4.) 0.734 0.013 54.902 0.000 0.734 0.700
## Dprss5_ (.p5.) 0.611 0.015 40.407 0.000 0.611 0.595
## Dprss6_ (.p6.) 0.602 0.015 41.143 0.000 0.602 0.581
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Depress1_f 0.000 0.000 0.000
## .Depress2_f 0.000 0.000 0.000
## .Depress3_f 0.000 0.000 0.000
## .Depress4_f 0.000 0.000 0.000
## .Depress5_f 0.000 0.000 0.000
## .Depress6_f 0.000 0.000 0.000
## depress -0.013 0.037 -0.364 0.716 -0.013 -0.013
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Dpr1_|1 (.p7.) -0.565 0.026 -21.510 0.000 -0.565 -0.572
## Dpr1_|2 (.p8.) 0.126 0.024 5.190 0.000 0.126 0.128
## Dpr1_|3 (.p9.) 1.082 0.030 36.172 0.000 1.082 1.096
## Dpr1_|4 (.10.) 1.768 0.042 42.022 0.000 1.768 1.791
## Dpr2_|1 (.11.) -0.886 0.028 -31.287 0.000 -0.886 -0.867
## Dpr2_|2 (.12.) -0.201 0.024 -8.287 0.000 -0.201 -0.196
## Dpr2_|3 (.13.) 0.741 0.026 27.969 0.000 0.741 0.725
## Dpr2_|4 (.14.) 1.523 0.036 41.830 0.000 1.523 1.491
## Dpr3_|1 (.15.) 0.290 0.025 11.450 0.000 0.290 0.278
## Dpr3_|2 (.16.) 0.679 0.027 25.325 0.000 0.679 0.651
## Dpr3_|3 (.17.) 1.200 0.032 37.683 0.000 1.200 1.149
## Dpr3_|4 (.18.) 1.658 0.040 41.070 0.000 1.658 1.589
## Dpr4_|1 (.19.) -0.115 0.025 -4.549 0.000 -0.115 -0.109
## Dpr4_|2 (.20.) 0.257 0.025 10.198 0.000 0.257 0.245
## Dpr4_|3 (.21.) 0.907 0.028 31.921 0.000 0.907 0.864
## Dpr4_|4 (.22.) 1.470 0.036 40.633 0.000 1.470 1.401
## Dpr5_|1 (.23.) -0.380 0.025 -15.342 0.000 -0.380 -0.370
## Dpr5_|2 (.24.) 0.068 0.023 2.926 0.003 0.068 0.067
## Dpr5_|3 (.25.) 0.675 0.026 25.926 0.000 0.675 0.657
## Dpr5_|4 (.26.) 1.246 0.033 37.568 0.000 1.246 1.213
## Dpr6_|1 (.27.) -0.442 0.025 -17.621 0.000 -0.442 -0.427
## Dpr6_|2 (.28.) 0.082 0.023 3.477 0.001 0.082 0.079
## Dpr6_|3 (.29.) 0.750 0.027 28.107 0.000 0.750 0.725
## Dpr6_|4 (.30.) 1.273 0.033 38.449 0.000 1.273 1.230
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Depress1_f 0.476 0.476 0.488
## .Depress2_f 0.605 0.605 0.580
## .Depress3_f 0.506 0.506 0.464
## .Depress4_f 0.562 0.562 0.510
## .Depress5_f 0.682 0.682 0.646
## .Depress6_f 0.709 0.709 0.662
## depress 1.000 1.000 1.000
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Depress1_f 1.013 0.018 56.739 0.000 1.013 1.000
## Depress2_f 0.979 0.018 55.918 0.000 0.979 1.000
## Depress3_f 0.958 0.019 49.293 0.000 0.958 1.000
## Depress4_f 0.953 0.020 48.613 0.000 0.953 1.000
## Depress5_f 0.973 0.024 40.348 0.000 0.973 1.000
## Depress6_f 0.966 0.023 41.212 0.000 0.966 1.000
## 2. Metric (Weak) Invariance Test (WLSMV)
model.metric.WLSMV <- '
depress =~ Depress1_f + Depress2_f + Depress3_f
+ Depress4_f + Depress5_f + Depress6_f
depress ~~ c(1, NA)*depress'
fit.metric.WLSMV <- cfa(model = model.metric.WLSMV, data = dat.inva,
mimic = "Mplus", estimator = "WLSMV",
std.lv = TRUE, group = "Grade",
ordered = c("Depress1_f", "Depress2_f",
"Depress3_f", "Depress4_f",
"Depress5_f", "Depress6_f"),
group.equal = "loadings")
summary(fit.metric.WLSMV, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 9 iterations
##
## Used Total
## Number of observations per group
## Grade_7 1811 1880
## Grade_6 2292 2404
##
## Estimator DWLS Robust
## Minimum Function Test Statistic 188.866 306.223
## Degrees of freedom 23 23
## P-value (Chi-square) 0.000 0.000
## Scaling correction factor 0.614
## Shift parameter for each group:
## Grade_7 -0.654
## Grade_6 -0.827
## for simple second-order correction (WLSMV)
##
## Chi-square for each group:
##
## Grade_7 73.253 118.692
## Grade_6 115.613 187.532
##
## Model test baseline model:
##
## Minimum Function Test Statistic 16164.928 11074.106
## Degrees of freedom 30 30
## P-value 0.000 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.990 0.974
## Tucker-Lewis Index (TLI) 0.987 0.967
##
## Robust Comparative Fit Index (CFI) NA
## Robust Tucker-Lewis Index (TLI) NA
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.059 0.077
## 90 Percent Confidence Interval 0.052 0.067 0.070 0.085
## P-value RMSEA <= 0.05 0.024 0.000
##
## Robust RMSEA NA
## 90 Percent Confidence Interval NA NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.036 0.036
##
## Weighted Root Mean Square Residual:
##
## WRMR 2.201 2.201
##
## Parameter Estimates:
##
## Information Expected
## Standard Errors Robust.sem
##
##
## Group 1 [Grade_7]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress =~
## Dprss1_ (.p1.) 0.716 0.012 57.899 0.000 0.716 0.716
## Dprss2_ (.p2.) 0.660 0.013 52.754 0.000 0.660 0.660
## Dprss3_ (.p3.) 0.753 0.013 56.194 0.000 0.753 0.753
## Dprss4_ (.p4.) 0.721 0.013 57.076 0.000 0.721 0.721
## Dprss5_ (.p5.) 0.607 0.014 43.692 0.000 0.607 0.607
## Dprss6_ (.p6.) 0.595 0.014 42.733 0.000 0.595 0.595
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Depress1_f 0.000 0.000 0.000
## .Depress2_f 0.000 0.000 0.000
## .Depress3_f 0.000 0.000 0.000
## .Depress4_f 0.000 0.000 0.000
## .Depress5_f 0.000 0.000 0.000
## .Depress6_f 0.000 0.000 0.000
## depress 0.000 0.000 0.000
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Depress1_f|t1 -0.591 0.031 -18.823 0.000 -0.591 -0.591
## Depress1_f|t2 0.142 0.030 4.815 0.000 0.142 0.142
## Depress1_f|t3 1.089 0.037 29.615 0.000 1.089 1.089
## Depress1_f|t4 1.780 0.055 32.603 0.000 1.780 1.780
## Depress2_f|t1 -0.945 0.035 -27.179 0.000 -0.945 -0.945
## Depress2_f|t2 -0.214 0.030 -7.207 0.000 -0.214 -0.214
## Depress2_f|t3 0.747 0.033 22.882 0.000 0.747 0.747
## Depress2_f|t4 1.535 0.046 33.163 0.000 1.535 1.535
## Depress3_f|t1 0.294 0.030 9.830 0.000 0.294 0.294
## Depress3_f|t2 0.702 0.032 21.768 0.000 0.702 0.702
## Depress3_f|t3 1.210 0.039 31.178 0.000 1.210 1.210
## Depress3_f|t4 1.722 0.052 32.881 0.000 1.722 1.722
## Depress4_f|t1 -0.094 0.030 -3.171 0.002 -0.094 -0.094
## Depress4_f|t2 0.267 0.030 8.940 0.000 0.267 0.267
## Depress4_f|t3 0.907 0.034 26.431 0.000 0.907 0.907
## Depress4_f|t4 1.504 0.045 33.113 0.000 1.504 1.504
## Depress5_f|t1 -0.394 0.030 -13.003 0.000 -0.394 -0.394
## Depress5_f|t2 0.070 0.029 2.373 0.018 0.070 0.070
## Depress5_f|t3 0.697 0.032 21.633 0.000 0.697 0.697
## Depress5_f|t4 1.279 0.040 31.871 0.000 1.279 1.279
## Depress6_f|t1 -0.481 0.031 -15.649 0.000 -0.481 -0.481
## Depress6_f|t2 0.069 0.029 2.326 0.020 0.069 0.069
## Depress6_f|t3 0.727 0.032 22.393 0.000 0.727 0.727
## Depress6_f|t4 1.230 0.039 31.398 0.000 1.230 1.230
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress 1.000 1.000 1.000
## .Depress1_f 0.487 0.487 0.487
## .Depress2_f 0.565 0.565 0.565
## .Depress3_f 0.434 0.434 0.434
## .Depress4_f 0.480 0.480 0.480
## .Depress5_f 0.632 0.632 0.632
## .Depress6_f 0.646 0.646 0.646
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Depress1_f 1.000 1.000 1.000
## Depress2_f 1.000 1.000 1.000
## Depress3_f 1.000 1.000 1.000
## Depress4_f 1.000 1.000 1.000
## Depress5_f 1.000 1.000 1.000
## Depress6_f 1.000 1.000 1.000
##
##
## Group 2 [Grade_6]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress =~
## Dprss1_ (.p1.) 0.716 0.012 57.899 0.000 0.706 0.706
## Dprss2_ (.p2.) 0.660 0.013 52.754 0.000 0.650 0.650
## Dprss3_ (.p3.) 0.753 0.013 56.194 0.000 0.742 0.742
## Dprss4_ (.p4.) 0.721 0.013 57.076 0.000 0.711 0.711
## Dprss5_ (.p5.) 0.607 0.014 43.692 0.000 0.598 0.598
## Dprss6_ (.p6.) 0.595 0.014 42.733 0.000 0.587 0.587
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Depress1_f 0.000 0.000 0.000
## .Depress2_f 0.000 0.000 0.000
## .Depress3_f 0.000 0.000 0.000
## .Depress4_f 0.000 0.000 0.000
## .Depress5_f 0.000 0.000 0.000
## .Depress6_f 0.000 0.000 0.000
## depress 0.000 0.000 0.000
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Depress1_f|t1 -0.543 0.028 -19.641 0.000 -0.543 -0.543
## Depress1_f|t2 0.125 0.026 4.760 0.000 0.125 0.125
## Depress1_f|t3 1.100 0.033 33.493 0.000 1.100 1.100
## Depress1_f|t4 1.791 0.049 36.607 0.000 1.791 1.791
## Depress2_f|t1 -0.815 0.030 -27.517 0.000 -0.815 -0.815
## Depress2_f|t2 -0.177 0.026 -6.721 0.000 -0.177 -0.177
## Depress2_f|t3 0.729 0.029 25.246 0.000 0.729 0.729
## Depress2_f|t4 1.490 0.040 37.216 0.000 1.490 1.490
## Depress3_f|t1 0.285 0.027 10.720 0.000 0.285 0.285
## Depress3_f|t2 0.642 0.028 22.727 0.000 0.642 0.642
## Depress3_f|t3 1.151 0.034 34.287 0.000 1.151 1.151
## Depress3_f|t4 1.557 0.042 37.328 0.000 1.557 1.557
## Depress4_f|t1 -0.117 0.026 -4.468 0.000 -0.117 -0.117
## Depress4_f|t2 0.246 0.026 9.305 0.000 0.246 0.246
## Depress4_f|t3 0.874 0.030 28.970 0.000 0.874 0.874
## Depress4_f|t4 1.386 0.038 36.737 0.000 1.386 1.386
## Depress5_f|t1 -0.350 0.027 -13.087 0.000 -0.350 -0.350
## Depress5_f|t2 0.073 0.026 2.798 0.005 0.073 0.073
## Depress5_f|t3 0.647 0.028 22.888 0.000 0.647 0.647
## Depress5_f|t4 1.197 0.034 34.915 0.000 1.197 1.197
## Depress6_f|t1 -0.388 0.027 -14.413 0.000 -0.388 -0.388
## Depress6_f|t2 0.097 0.026 3.717 0.000 0.097 0.097
## Depress6_f|t3 0.752 0.029 25.878 0.000 0.752 0.752
## Depress6_f|t4 1.275 0.036 35.813 0.000 1.275 1.275
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress 0.973 0.033 29.086 0.000 1.000 1.000
## .Depress1_f 0.501 0.501 0.501
## .Depress2_f 0.577 0.577 0.577
## .Depress3_f 0.449 0.449 0.449
## .Depress4_f 0.494 0.494 0.494
## .Depress5_f 0.642 0.642 0.642
## .Depress6_f 0.655 0.655 0.655
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Depress1_f 1.000 1.000 1.000
## Depress2_f 1.000 1.000 1.000
## Depress3_f 1.000 1.000 1.000
## Depress4_f 1.000 1.000 1.000
## Depress5_f 1.000 1.000 1.000
## Depress6_f 1.000 1.000 1.000
lavTestLRT(fit.config.WLSMV, fit.metric.WLSMV, method = "satorra.bentler.2010", A.method = "delta")
## Scaled Chi Square Difference Test (method = "satorra.bentler.2010")
##
## Df AIC BIC Chisq Chisq diff Df diff Pr(>Chisq)
## fit.metric.WLSMV 23 188.87
## fit.config.WLSMV 41 210.49 22.609 18 0.2061
## 3. Scalar (Strong) Invariance Test (WLSMV)
model.scalar.WLSMV <- '
depress =~ Depress1_f + Depress2_f + Depress3_f
+ Depress4_f + Depress5_f + Depress6_f
depress ~~ c(1, NA)*depress
depress ~ c(0, NA)*1
'
fit.scalar.WLSMV <- cfa(model = model.scalar.WLSMV, data = dat.inva,
mimic = "Mplus", estimator = "WLSMV",
std.lv = TRUE, group = "Grade",
ordered = c("Depress1_f", "Depress2_f",
"Depress3_f", "Depress4_f",
"Depress5_f", "Depress6_f"),
group.equal = c("loadings", "thresholds"))
summary(fit.scalar.WLSMV, fit.measures = TRUE, standardized = TRUE)
## lavaan (0.5-22) converged normally after 28 iterations
##
## Used Total
## Number of observations per group
## Grade_7 1811 1880
## Grade_6 2292 2404
##
## Estimator DWLS Robust
## Minimum Function Test Statistic 201.376 330.890
## Degrees of freedom 40 40
## P-value (Chi-square) 0.000 0.000
## Scaling correction factor 0.603
## Shift parameter for each group:
## Grade_7 -1.415
## Grade_6 -1.791
## for simple second-order correction (WLSMV)
##
## Chi-square for each group:
##
## Grade_7 79.770 130.929
## Grade_6 121.605 199.960
##
## Model test baseline model:
##
## Minimum Function Test Statistic 16164.928 11074.106
## Degrees of freedom 30 30
## P-value 0.000 0.000
##
## User model versus baseline model:
##
## Comparative Fit Index (CFI) 0.990 0.974
## Tucker-Lewis Index (TLI) 0.992 0.980
##
## Robust Comparative Fit Index (CFI) NA
## Robust Tucker-Lewis Index (TLI) NA
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.044 0.060
## 90 Percent Confidence Interval 0.038 0.051 0.054 0.066
## P-value RMSEA <= 0.05 0.933 0.004
##
## Robust RMSEA NA
## 90 Percent Confidence Interval NA NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.037 0.037
##
## Weighted Root Mean Square Residual:
##
## WRMR 2.272 2.272
##
## Parameter Estimates:
##
## Information Expected
## Standard Errors Robust.sem
##
##
## Group 1 [Grade_7]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress =~
## Dprss1_ (.p1.) 0.701 0.013 52.280 0.000 0.701 0.701
## Dprss2_ (.p2.) 0.656 0.014 47.423 0.000 0.656 0.656
## Dprss3_ (.p3.) 0.760 0.015 51.164 0.000 0.760 0.760
## Dprss4_ (.p4.) 0.732 0.014 52.473 0.000 0.732 0.732
## Dprss5_ (.p5.) 0.607 0.016 38.240 0.000 0.607 0.607
## Dprss6_ (.p6.) 0.598 0.015 38.679 0.000 0.598 0.598
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress 0.000 0.000 0.000
## .Depress1_f 0.000 0.000 0.000
## .Depress2_f 0.000 0.000 0.000
## .Depress3_f 0.000 0.000 0.000
## .Depress4_f 0.000 0.000 0.000
## .Depress5_f 0.000 0.000 0.000
## .Depress6_f 0.000 0.000 0.000
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Dpr1_|1 (.p9.) -0.585 0.027 -21.695 0.000 -0.585 -0.585
## Dpr1_|2 (.10.) 0.121 0.024 4.980 0.000 0.121 0.121
## Dpr1_|3 (.11.) 1.096 0.032 34.565 0.000 1.096 1.096
## Dpr1_|4 (.12.) 1.795 0.046 39.334 0.000 1.795 1.795
## Dpr2_|1 (.13.) -0.910 0.029 -30.915 0.000 -0.910 -0.910
## Dpr2_|2 (.14.) -0.212 0.024 -8.753 0.000 -0.212 -0.212
## Dpr2_|3 (.15.) 0.746 0.027 27.438 0.000 0.746 0.746
## Dpr2_|4 (.16.) 1.542 0.039 39.672 0.000 1.542 1.542
## Dpr3_|1 (.17.) 0.288 0.025 11.342 0.000 0.288 0.288
## Dpr3_|2 (.18.) 0.685 0.028 24.801 0.000 0.685 0.685
## Dpr3_|3 (.19.) 1.216 0.034 35.484 0.000 1.216 1.216
## Dpr3_|4 (.20.) 1.687 0.044 38.020 0.000 1.687 1.687
## Dpr4_|1 (.21.) -0.125 0.025 -4.969 0.000 -0.125 -0.125
## Dpr4_|2 (.22.) 0.255 0.025 10.074 0.000 0.255 0.255
## Dpr4_|3 (.23.) 0.919 0.030 30.907 0.000 0.919 0.919
## Dpr4_|4 (.24.) 1.496 0.039 38.156 0.000 1.496 1.496
## Dpr5_|1 (.25.) -0.395 0.025 -15.910 0.000 -0.395 -0.395
## Dpr5_|2 (.26.) 0.063 0.023 2.679 0.007 0.063 0.063
## Dpr5_|3 (.27.) 0.682 0.027 25.606 0.000 0.682 0.682
## Dpr5_|4 (.28.) 1.265 0.035 36.580 0.000 1.265 1.265
## Dpr6_|1 (.29.) -0.458 0.025 -18.074 0.000 -0.458 -0.458
## Dpr6_|2 (.30.) 0.076 0.024 3.239 0.001 0.076 0.076
## Dpr6_|3 (.31.) 0.757 0.027 27.632 0.000 0.757 0.757
## Dpr6_|4 (.32.) 1.289 0.034 37.387 0.000 1.289 1.289
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress 1.000 1.000 1.000
## .Depress1_f 0.509 0.509 0.509
## .Depress2_f 0.569 0.569 0.569
## .Depress3_f 0.423 0.423 0.423
## .Depress4_f 0.465 0.465 0.465
## .Depress5_f 0.632 0.632 0.632
## .Depress6_f 0.643 0.643 0.643
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Depress1_f 1.000 1.000 1.000
## Depress2_f 1.000 1.000 1.000
## Depress3_f 1.000 1.000 1.000
## Depress4_f 1.000 1.000 1.000
## Depress5_f 1.000 1.000 1.000
## Depress6_f 1.000 1.000 1.000
##
##
## Group 2 [Grade_6]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress =~
## Dprss1_ (.p1.) 0.701 0.013 52.280 0.000 0.736 0.719
## Dprss2_ (.p2.) 0.656 0.014 47.423 0.000 0.689 0.653
## Dprss3_ (.p3.) 0.760 0.015 51.164 0.000 0.798 0.736
## Dprss4_ (.p4.) 0.732 0.014 52.473 0.000 0.768 0.702
## Dprss5_ (.p5.) 0.607 0.016 38.240 0.000 0.637 0.598
## Dprss6_ (.p6.) 0.598 0.015 38.679 0.000 0.627 0.585
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress -0.036 0.037 -0.973 0.330 -0.034 -0.034
## .Depress1_f 0.000 0.000 0.000
## .Depress2_f 0.000 0.000 0.000
## .Depress3_f 0.000 0.000 0.000
## .Depress4_f 0.000 0.000 0.000
## .Depress5_f 0.000 0.000 0.000
## .Depress6_f 0.000 0.000 0.000
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Dpr1_|1 (.p9.) -0.585 0.027 -21.695 0.000 -0.585 -0.572
## Dpr1_|2 (.10.) 0.121 0.024 4.980 0.000 0.121 0.118
## Dpr1_|3 (.11.) 1.096 0.032 34.565 0.000 1.096 1.070
## Dpr1_|4 (.12.) 1.795 0.046 39.334 0.000 1.795 1.754
## Dpr2_|1 (.13.) -0.910 0.029 -30.915 0.000 -0.910 -0.863
## Dpr2_|2 (.14.) -0.212 0.024 -8.753 0.000 -0.212 -0.201
## Dpr2_|3 (.15.) 0.746 0.027 27.438 0.000 0.746 0.708
## Dpr2_|4 (.16.) 1.542 0.039 39.672 0.000 1.542 1.462
## Dpr3_|1 (.17.) 0.288 0.025 11.342 0.000 0.288 0.265
## Dpr3_|2 (.18.) 0.685 0.028 24.801 0.000 0.685 0.631
## Dpr3_|3 (.19.) 1.216 0.034 35.484 0.000 1.216 1.121
## Dpr3_|4 (.20.) 1.687 0.044 38.020 0.000 1.687 1.556
## Dpr4_|1 (.21.) -0.125 0.025 -4.969 0.000 -0.125 -0.114
## Dpr4_|2 (.22.) 0.255 0.025 10.074 0.000 0.255 0.233
## Dpr4_|3 (.23.) 0.919 0.030 30.907 0.000 0.919 0.840
## Dpr4_|4 (.24.) 1.496 0.039 38.156 0.000 1.496 1.368
## Dpr5_|1 (.25.) -0.395 0.025 -15.910 0.000 -0.395 -0.370
## Dpr5_|2 (.26.) 0.063 0.023 2.679 0.007 0.063 0.059
## Dpr5_|3 (.27.) 0.682 0.027 25.606 0.000 0.682 0.639
## Dpr5_|4 (.28.) 1.265 0.035 36.580 0.000 1.265 1.187
## Dpr6_|1 (.29.) -0.458 0.025 -18.074 0.000 -0.458 -0.427
## Dpr6_|2 (.30.) 0.076 0.024 3.239 0.001 0.076 0.071
## Dpr6_|3 (.31.) 0.757 0.027 27.632 0.000 0.757 0.706
## Dpr6_|4 (.32.) 1.289 0.034 37.387 0.000 1.289 1.203
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## depress 1.102 0.073 15.043 0.000 1.000 1.000
## .Depress1_f 0.506 0.506 0.483
## .Depress2_f 0.637 0.637 0.573
## .Depress3_f 0.540 0.540 0.459
## .Depress4_f 0.607 0.607 0.507
## .Depress5_f 0.730 0.730 0.643
## .Depress6_f 0.755 0.755 0.657
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Depress1_f 0.977 0.025 39.059 0.000 0.977 1.000
## Depress2_f 0.948 0.023 41.419 0.000 0.948 1.000
## Depress3_f 0.922 0.026 35.114 0.000 0.922 1.000
## Depress4_f 0.914 0.025 36.812 0.000 0.914 1.000
## Depress5_f 0.938 0.026 35.440 0.000 0.938 1.000
## Depress6_f 0.933 0.026 35.862 0.000 0.933 1.000
lavTestLRT(fit.metric.WLSMV, fit.scalar.WLSMV, method = "satorra.bentler.2010", A.method = "delta")
## Scaled Chi Square Difference Test (method = "satorra.bentler.2010")
##
## Df AIC BIC Chisq Chisq diff Df diff Pr(>Chisq)
## fit.metric.WLSMV 23 188.87
## fit.scalar.WLSMV 40 201.38 21.469 17 0.206
## 4. Metric and Scalar Combined Test (WLSMV)
lavTestLRT(fit.config.WLSMV, fit.scalar.WLSMV, method = "satorra.bentler.2010", A.method = "delta")
## Scaled Chi Square Difference Test (method = "satorra.bentler.2010")
##
## Df AIC BIC Chisq Chisq diff Df diff Pr(>Chisq)
## fit.scalar.WLSMV 40 201.38
## fit.config.WLSMV 41 210.49 1.2625 1 0.2612