Thank you so much for your help Yves! Unfortunately assing the missing command did not make a difference
twolevel <- '
group: 1
level: 1
f1 =~ relaxed + happy + euphoric
f2 =~ depressed + stressed + anxious + anger
level: 2
relaxed ~~ relaxed + happy + euphoric + depressed + stressed + anxious + anger
happy ~~ happy + euphoric + depressed + stressed + anxious + anger
euphoric ~~ euphoric + depressed + stressed + anxious + anger
depressed ~~ depressed + stressed + anxious + anger
stressed ~~ stressed + anxious + anger
anxious ~~ anxious + anger
anger ~~ anger
group: 2
level: 1
f1 =~ relaxed + happy + euphoric
f2 =~ depressed + stressed + anxious + anger
level: 2
relaxed ~~ relaxed + happy + euphoric + depressed + stressed + anxious + anger
happy ~~ happy + euphoric + depressed + stressed + anxious + anger
euphoric ~~ euphoric + depressed + stressed + anxious + anger
depressed ~~ depressed + stressed + anxious + anger
stressed ~~ stressed + anxious + anger
anxious ~~ anxious + anger
anger ~~ anger
'
results <- cfa(twolevel, data = data, group = "HC", cluster = 'PID', estimator = "MLR", missing = "ML", effect.coding = TRUE)
The data is non-normal that's why I was using MLR (which is the Yuan Bentler scaled statistic right) also there is little variance on the items in group two. Should I look at the scaled statistic or the robust standard error statistic in lavaan to match it with MPLUS?
UNIVARIATE SAMPLE STATISTICS
UNIVARIATE HIGHER-ORDER MOMENT DESCRIPTIVE STATISTICS FOR G1
Variable/ Mean/ Skewness/ Minimum/ % with Percentiles
Sample Size Variance Kurtosis Maximum Min/Max 20%/60% 40%/80% Median
RELAXED 36.996 0.349 0.000 3.49% 14.000 28.000 35.000
4619.000 538.437 -0.564 100.000 0.91% 44.000 57.000
HAPPY 31.387 0.566 0.000 6.41% 9.000 21.000 27.000
4619.000 551.156 -0.497 100.000 0.48% 35.000 53.000
EUPHORIC 19.249 1.460 0.000 14.96% 2.000 8.000 11.000
4619.000 451.769 1.621 100.000 0.35% 16.000 35.000
DEPR 46.568 0.030 0.000 3.85% 17.000 39.000 49.000
4619.000 783.234 -0.983 100.000 3.18% 55.000 73.000
STRESS 46.752 0.039 0.000 2.62% 20.000 39.000 48.000
4619.000 723.872 -0.898 100.000 2.90% 55.000 72.000
ANXIOUS 36.450 0.437 0.000 5.76% 9.000 23.000 32.000
4619.000 744.584 -0.905 100.000 1.43% 43.000 63.000
ANGER 26.471 1.141 0.000 11.63% 4.000 12.000 17.000
4619.000 692.231 0.438 100.000 2.36% 24.000 50.000
UNIVARIATE HIGHER-ORDER MOMENT DESCRIPTIVE STATISTICS FOR G2
Variable/ Mean/ Skewness/ Minimum/ % with Percentiles
Sample Size Variance Kurtosis Maximum Min/Max 20%/60% 40%/80% Median
RELAXED 56.542 -0.464 0.000 0.97% 39.000 52.000 58.000
2576.000 455.401 -0.174 100.000 1.05% 64.000 75.000
HAPPY 50.985 -0.473 0.000 1.16% 32.000 49.000 53.000
2576.000 477.775 -0.379 100.000 0.19% 59.000 71.000
EUPHORIC 25.417 0.627 0.000 13.08% 3.000 9.000 16.000
2576.000 567.208 -0.861 99.000 0.04% 29.000 50.000
DEPR 5.890 3.716 0.000 28.03% 0.000 2.000 4.000
2576.000 69.029 22.211 100.000 0.04% 5.000 9.000
STRESS 17.847 1.397 0.000 13.12% 2.000 7.000 9.000
2576.000 385.101 1.237 98.000 0.04% 14.000 33.000
ANXIOUS 6.154 3.875 0.000 27.52% 0.000 2.000 4.000
2576.000 94.272 19.440 84.000 0.08% 5.000 9.000
ANGER 6.524 3.488 0.000 26.75% 0.000 2.000 4.000
2576.000 97.546 15.292 83.000 0.04% 6.000 9.000
THE STANDARD ERRORS OF THE MODEL PARAMETER ESTIMATES MAY NOT BE
TRUSTWORTHY FOR SOME PARAMETERS DUE TO A NON-POSITIVE DEFINITE
FIRST-ORDER DERIVATIVE PRODUCT MATRIX. THIS MAY BE DUE TO THE STARTING
VALUES BUT MAY ALSO BE AN INDICATION OF MODEL NONIDENTIFICATION. THE
CONDITION NUMBER IS -0.791D-19. PROBLEM INVOLVING THE FOLLOWING PARAMETER:
Parameter 95, Group G2, %BETWEEN%: ANXIOUS WITH DEPR
Here is the lavaan output
lavaan 0.6-6 ended normally after 803 iterations
Estimator ML
Optimization method NLMINB
Number of free parameters 104
Number of equality constraints 4
Number of observations per group: Used Total
0 4619 5460
1 2576 2800
Number of clusters [PID]:
0 78
1 40
Model Test User Model:
Standard Robust
Test Statistic 1004.143 204.885
Degrees of freedom 26 26
P-value (Chi-square) 0.000 0.000
Scaling correction factor 4.901
Yuan-Bentler correction (Mplus variant)
Test statistic for each group:
0 701.196 143.072
1 302.947 61.813
Model Test Baseline Model:
Test statistic 12537.945 6089.715
Degrees of freedom 84 84
P-value 0.000 0.000
Scaling correction factor 2.059
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.921 0.970
Tucker-Lewis Index (TLI) 0.746 0.904
Robust Comparative Fit Index (CFI) 0.929
Robust Tucker-Lewis Index (TLI) 0.771
Loglikelihood and Information Criteria:
Loglikelihood user model (H0) -206597.021 -206597.021
Scaling correction factor 4.683
for the MLR correction
Loglikelihood unrestricted model (H1) -206094.950 -206094.950
Scaling correction factor 4.876
for the MLR correction
Akaike (AIC) 413394.043 413394.043
Bayesian (BIC) 414082.157 414082.157
Sample-size adjusted Bayesian (BIC) 413764.379 413764.379
Root Mean Square Error of Approximation:
RMSEA 0.102 0.044
90 Percent confidence interval - lower 0.097 0.041
90 Percent confidence interval - upper 0.108 0.046
P-value RMSEA <= 0.05 0.000 1.000
Robust RMSEA 0.097
90 Percent confidence interval - lower 0.085
90 Percent confidence interval - upper 0.109
Standardized Root Mean Square Residual (corr metric):
SRMR (within covariance matrix) 0.072 0.072
SRMR (between covariance matrix) 0.087 0.087
Parameter Estimates:
Standard errors Sandwich
Information bread Observed
Observed information based on Hessian
Group 1 [0]:
Level 1 [within]:
Latent Variables:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
f1 =~
relaxed 1.069 0.053 20.176 0.000 13.823 0.696
happy 1.173 0.036 32.148 0.000 15.157 0.803
euphoric 0.758 0.059 12.930 0.000 9.801 0.641
f2 =~
depressed 0.993 0.039 25.732 0.000 12.734 0.705
stressed 1.143 0.038 30.021 0.000 14.651 0.699
anxious 0.975 0.047 20.778 0.000 12.494 0.641
anger 0.889 0.045 19.569 0.000 11.400 0.587
Covariances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
f1 ~~
f2 -119.626 18.094 -6.611 0.000 -0.722 -0.722
Intercepts:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.relaxed 0.000 0.000 0.000
.happy 0.000 0.000 0.000
.euphoric 0.000 0.000 0.000
.depressed 0.000 0.000 0.000
.stressed 0.000 0.000 0.000
.anxious 0.000 0.000 0.000
.anger 0.000 0.000 0.000
f1 0.000 0.000 0.000
f2 0.000 0.000 0.000
Variances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.relaxed 202.900 17.561 11.554 0.000 202.900 0.515
.happy 126.161 15.760 8.005 0.000 126.161 0.354
.euphoric 137.933 13.437 10.265 0.000 137.933 0.589
.depressed 164.391 12.958 12.687 0.000 164.391 0.503
.stressed 224.582 18.955 11.848 0.000 224.582 0.511
.anxious 224.269 19.891 11.275 0.000 224.269 0.590
.anger 247.230 21.273 11.622 0.000 247.230 0.655
f1 167.112 24.664 6.775 0.000 1.000 1.000
f2 164.344 17.482 9.401 0.000 1.000 1.000
Level 2 [PID]:
Covariances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.relaxed ~~
.happy 183.183 71.113 2.576 0.010 183.183 0.844
.euphoric 177.380 79.849 2.221 0.026 177.380 0.749
.depressed -85.146 30.383 -2.802 0.005 -85.146 -0.347
.stressed -59.927 25.013 -2.396 0.017 -59.927 -0.307
.anxious -46.632 26.254 -1.776 0.076 -46.632 -0.204
.anger -5.903 25.569 -0.231 0.817 -5.903 -0.026
.happy ~~
.euphoric 214.853 85.880 2.502 0.012 214.853 0.809
.depressed -101.042 33.847 -2.985 0.003 -101.042 -0.367
.stressed -50.513 23.396 -2.159 0.031 -50.513 -0.231
.anxious -19.262 27.359 -0.704 0.481 -19.262 -0.075
.anger -3.349 30.510 -0.110 0.913 -3.349 -0.013
.euphoric ~~
.depressed -51.806 34.071 -1.521 0.128 -51.806 -0.172
.stressed -17.512 25.753 -0.680 0.497 -17.512 -0.073
.anxious 4.367 29.637 0.147 0.883 4.367 0.016
.anger 35.535 34.488 1.030 0.303 35.535 0.129
.depressed ~~
.stressed 181.122 27.687 6.542 0.000 181.122 0.732
.anxious 148.201 30.799 4.812 0.000 148.201 0.512
.anger 74.111 26.855 2.760 0.006 74.111 0.259
.stressed ~~
.anxious 158.462 23.172 6.839 0.000 158.462 0.689
.anger 64.895 17.345 3.741 0.000 64.895 0.286
.anxious ~~
.anger 126.549 29.914 4.230 0.000 126.549 0.476
Intercepts:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.relaxed 37.093 1.397 26.550 0.000 37.093 2.667
.happy 31.653 1.600 19.786 0.000 31.653 2.028
.euphoric 19.473 1.671 11.654 0.000 19.473 1.144
.depressed 46.157 2.445 18.875 0.000 46.157 2.615
.stressed 46.546 1.946 23.917 0.000 46.546 3.321
.anxious 36.176 2.196 16.475 0.000 36.176 2.204
.anger 26.263 1.986 13.227 0.000 26.263 1.622
Variances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.relaxed 193.449 68.370 2.829 0.005 193.449 1.000
.happy 243.499 76.769 3.172 0.002 243.499 1.000
.euphoric 289.701 95.532 3.033 0.002 289.701 1.000
.depressed 311.473 31.858 9.777 0.000 311.473 1.000
.stressed 196.482 24.620 7.981 0.000 196.482 1.000
.anxious 269.494 26.147 10.307 0.000 269.494 1.000
.anger 262.297 65.434 4.009 0.000 262.297 1.000
Group 2 [1]:
Level 1 [within]:
Latent Variables:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
f1 =~
relaxed 1.317 0.158 8.352 0.000 12.850 0.678
happy 1.095 0.100 11.001 0.000 10.686 0.625
euphoric 0.588 0.088 6.701 0.000 5.732 0.399
f2 =~
depressed 0.439 0.119 3.699 0.000 2.295 0.348
stressed 2.041 0.307 6.636 0.000 10.661 0.669
anxious 0.606 0.130 4.674 0.000 3.165 0.428
anger 0.914 0.130 7.019 0.000 4.777 0.537
Covariances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
f1 ~~
f2 -34.900 6.411 -5.444 0.000 -0.685 -0.685
Intercepts:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.relaxed 0.000 0.000 0.000
.happy 0.000 0.000 0.000
.euphoric 0.000 0.000 0.000
.depressed 0.000 0.000 0.000
.stressed 0.000 0.000 0.000
.anxious 0.000 0.000 0.000
.anger 0.000 0.000 0.000
f1 0.000 0.000 0.000
f2 0.000 0.000 0.000
Variances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.relaxed 193.606 31.926 6.064 0.000 193.606 0.540
.happy 178.251 28.080 6.348 0.000 178.251 0.610
.euphoric 173.283 26.934 6.434 0.000 173.283 0.841
.depressed 38.194 7.228 5.284 0.000 38.194 0.879
.stressed 140.026 25.278 5.539 0.000 140.026 0.552
.anxious 44.588 12.118 3.680 0.000 44.588 0.817
.anger 56.348 11.235 5.016 0.000 56.348 0.712
f1 95.172 14.247 6.680 0.000 1.000 1.000
f2 27.298 5.478 4.983 0.000 1.000 1.000
Level 2 [PID]:
Covariances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.relaxed ~~
.happy 68.983 35.983 1.917 0.055 68.983 0.561
.euphoric 27.250 29.095 0.937 0.349 27.250 0.159
.depressed -15.374 1951.805 -0.008 0.994 -15.374 -0.121
.stressed -60.246 193.316 -0.312 0.755 -60.246 -0.540
.anxious -15.328 2352.072 -0.007 0.995 -15.328 -0.100
.anger -5.536 1556.384 -0.004 0.997 -5.536 -0.055
.happy ~~
.euphoric 42.500 60.541 0.702 0.483 42.500 0.186
.depressed -19.014 1406.841 -0.014 0.989 -19.014 -0.112
.stressed -11.599 109.474 -0.106 0.916 -11.599 -0.078
.anxious 3.535 1705.408 0.002 0.998 3.535 0.017
.anger 4.606 1139.787 0.004 0.997 4.606 0.034
.euphoric ~~
.depressed 23.487 239.438 0.098 0.922 23.487 0.100
.stressed 31.003 42.216 0.734 0.463 31.003 0.150
.anxious 2.256 273.280 0.008 0.993 2.256 0.008
.anger 8.979 188.400 0.048 0.962 8.979 0.048
.depressed ~~
.stressed 37.847 2173.835 0.017 0.986 37.847 0.246
.anxious 199.126 1123.980 0.177 0.859 199.126 0.945
.anger 132.981 46.396 2.866 0.004 132.981 0.951
.stressed ~~
.anxious 43.338 2616.937 0.017 0.987 43.338 0.234
.anger 27.316 1664.291 0.016 0.987 27.316 0.222
.anxious ~~
.anger 164.389 48.754 3.372 0.001 164.389 0.976
Intercepts:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.relaxed 56.300 1.644 34.250 0.000 56.300 5.861
.happy 50.834 2.217 22.931 0.000 50.834 3.972
.euphoric 25.385 3.094 8.204 0.000 25.385 1.424
.depressed 6.074 0.887 6.845 0.000 6.074 0.459
.stressed 18.197 1.964 9.266 0.000 18.197 1.566
.anxious 6.287 1.084 5.800 0.000 6.287 0.395
.anger 6.613 0.781 8.468 0.000 6.613 0.626
Variances:
Estimate Std.Err z-value P(>|z|) Std.lv Std.all
.relaxed 92.257 20.874 4.420 0.000 92.257 1.000
.happy 163.771 76.693 2.135 0.033 163.771 1.000
.euphoric 317.867 84.888 3.745 0.000 317.867 1.000
.depressed 174.980 941.596 0.186 0.853 174.980 1.000
.stressed 135.112 408.318 0.331 0.741 135.112 1.000
.anxious 253.984 1329.789 0.191 0.849 253.984 1.000
.anger 111.689 544.016 0.205 0.837 111.689 1.000
This is the MPLUS Output:
THE MODEL ESTIMATION TERMINATED NORMALLY
MODEL FIT INFORMATION
Number of Free Parameters 100
Loglikelihood
H0 Value -206555.230
H0 Scaling Correction Factor 5.6264
for MLR
H1 Value -206094.950
H1 Scaling Correction Factor 4.8763
for MLR
Information Criteria
Akaike (AIC) 413310.460
Bayesian (BIC) 413998.575
Sample-Size Adjusted BIC 413680.797
(n* = (n + 2) / 24)
Chi-Square Test of Model Fit
Value 462.303*
Degrees of Freedom 26
P-Value 0.0000
Scaling Correction Factor 1.9912
for MLR
Chi-Square Contribution From Each Group
G1 339.956
G2 122.347
* The chi-square value for MLM, MLMV, MLR, ULSMV, WLSM and WLSMV cannot be used
for chi-square difference testing in the regular way. MLM, MLR and WLSM
chi-square difference testing is described on the Mplus website. MLMV, WLSMV,
and ULSMV difference testing is done using the DIFFTEST option.
RMSEA (Root Mean Square Error Of Approximation)
Estimate 0.068
CFI/TLI
CFI 0.923
TLI 0.751
Chi-Square Test of Model Fit for the Baseline Model
Value 5736.973
Degrees of Freedom 84
P-Value 0.0000
SRMR (Standardized Root Mean Square Residual)
Value for Within 0.049
Value for Between 0.001
MODEL RESULTS
Two-Tailed
Estimate S.E. Est./S.E. P-Value
Group G1
Within Level
FW1 BY
RELAXED 1.069 0.054 19.869 0.000
HAPPY 1.173 0.037 31.668 0.000
EUPHORIC 0.758 0.060 12.738 0.000
FW2 BY
DEPR 0.993 0.039 25.354 0.000
STRESS 1.143 0.039 29.587 0.000
ANXIOUS 0.975 0.048 20.475 0.000
ANGER 0.889 0.046 19.284 0.000
FW2 WITH
FW1 -119.437 18.317 -6.521 0.000
Variances
FW1 166.839 24.962 6.684 0.000
FW2 164.222 17.708 9.274 0.000
Residual Variances
RELAXED 202.918 17.822 11.386 0.000
HAPPY 126.180 15.998 7.887 0.000
EUPHORIC 137.944 13.637 10.115 0.000
DEPR 164.406 13.151 12.502 0.000
STRESS 224.569 19.232 11.677 0.000
ANXIOUS 224.263 20.184 11.111 0.000
ANGER 247.221 21.585 11.454 0.000
Between Level
RELAXED WITH
HAPPY 139.316 24.588 5.666 0.000
EUPHORIC 115.834 25.422 4.556 0.000
DEPR -139.878 36.749 -3.806 0.000
STRESS -98.271 30.750 -3.196 0.001
ANXIOUS -82.996 31.896 -2.602 0.009
ANGER -30.181 23.441 -1.288 0.198
HAPPY WITH
EUPHORIC 157.016 30.493 5.149 0.000
DEPR -158.841 38.750 -4.099 0.000
STRESS -86.356 28.814 -2.997 0.003
ANXIOUS -65.562 33.715 -1.945 0.052
ANGER -21.147 30.242 -0.699 0.484
EUPHORIC WITH
DEPR -83.479 37.108 -2.250 0.024
STRESS -26.632 28.113 -0.947 0.343
ANXIOUS -14.368 31.757 -0.452 0.651
ANGER 29.231 31.789 0.920 0.358
DEPR WITH
STRESS 309.895 55.844 5.549 0.000
ANXIOUS 301.188 56.026 5.376 0.000
ANGER 176.704 49.444 3.574 0.000
STRESS WITH
ANXIOUS 269.815 45.628 5.913 0.000
ANGER 143.655 33.815 4.248 0.000
ANXIOUS WITH
ANGER 207.094 47.085 4.398 0.000
Means
RELAXED 37.094 1.418 26.162 0.000
HAPPY 31.656 1.624 19.492 0.000
EUPHORIC 19.475 1.696 11.485 0.000
DEPR 46.152 2.482 18.594 0.000
STRESS 46.543 1.976 23.555 0.000
ANXIOUS 36.171 2.229 16.228 0.000
ANGER 26.260 2.015 13.033 0.000
Variances
RELAXED 150.020 25.422 5.901 0.000
HAPPY 199.688 28.325 7.050 0.000
EUPHORIC 220.247 33.950 6.487 0.000
DEPR 475.004 65.052 7.302 0.000
STRESS 297.040 49.065 6.054 0.000
ANXIOUS 380.927 47.721 7.982 0.000
ANGER 310.559 79.794 3.892 0.000
Group G2
Within Level
FW1 BY
RELAXED 1.316 0.153 8.615 0.000
HAPPY 1.095 0.096 11.365 0.000
EUPHORIC 0.589 0.085 6.921 0.000
FW2 BY
DEPR 0.439 0.116 3.805 0.000
STRESS 2.041 0.299 6.824 0.000
ANXIOUS 0.606 0.126 4.806 0.000
ANGER 0.914 0.127 7.216 0.000
FW2 WITH
FW1 -35.150 6.296 -5.583 0.000
Variances
FW1 96.203 14.069 6.838 0.000
FW2 27.375 5.350 5.117 0.000
Residual Variances
RELAXED 193.419 31.107 6.218 0.000
HAPPY 177.940 27.334 6.510 0.000
EUPHORIC 173.160 26.176 6.615 0.000
DEPR 38.194 7.028 5.434 0.000
STRESS 140.009 24.579 5.696 0.000
ANXIOUS 44.584 11.800 3.778 0.000
ANGER 56.351 10.929 5.156 0.000
Between Level
RELAXED WITH
HAPPY 80.059 25.070 3.193 0.001
EUPHORIC 48.679 31.650 1.538 0.124
DEPR -14.958 9.947 -1.504 0.133
STRESS -61.758 24.159 -2.556 0.011
ANXIOUS -14.314 13.901 -1.030 0.303
ANGER -7.391 7.446 -0.993 0.321
HAPPY WITH
EUPHORIC 131.251 40.228 3.263 0.001
DEPR -18.035 13.626 -1.324 0.186
STRESS -17.786 23.204 -0.767 0.443
ANXIOUS 1.135 7.815 0.145 0.885
ANGER 0.872 7.279 0.120 0.905
EUPHORIC WITH
DEPR 15.430 16.221 0.951 0.341
STRESS 57.405 36.128 1.589 0.112
ANXIOUS 12.330 17.462 0.706 0.480
ANGER 13.161 13.629 0.966 0.334
DEPR WITH
STRESS 26.753 17.818 1.502 0.133
ANXIOUS 23.289 7.158 3.254 0.001
ANGER 17.103 5.535 3.090 0.002
STRESS WITH
ANXIOUS 26.590 16.109 1.651 0.099
ANGER 19.770 9.183 2.153 0.031
ANXIOUS WITH
ANGER 24.147 9.619 2.510 0.012
Means
RELAXED 56.296 1.595 35.301 0.000
HAPPY 50.829 2.152 23.620 0.000
EUPHORIC 25.385 3.011 8.431 0.000
DEPR 6.075 0.848 7.160 0.000
STRESS 18.202 1.903 9.565 0.000
ANXIOUS 6.289 1.025 6.137 0.000
ANGER 6.616 0.712 9.292 0.000
Variances
RELAXED 96.312 20.017 4.812 0.000
HAPPY 180.597 43.711 4.132 0.000
EUPHORIC 359.496 52.770 6.813 0.000
DEPR 28.016 8.678 3.228 0.001
STRESS 140.681 42.570 3.305 0.001
ANXIOUS 41.096 21.945 1.873 0.061
ANGER 19.065 5.508 3.461 0.001
QUALITY OF NUMERICAL RESULTS
Condition Number for the Information Matrix -0.791E-19
(ratio of smallest to largest eigenvalue)