Lavaan and MPLUS different test statistics

閲覧: 566 回
最初の未読メッセージにスキップ

Leoni

未読、
2020/06/03 12:11:522020/06/03
To: lavaan
Dear Group, 

I am fitting a multilevel CFA on two groups to test for invariance of factor loadings on the Within Person Model. 
I specified two factors with 3 and 4 indicators at Level 1 and a saturated model at Level 2. 
I used effect coding to set the metric of the latent variables and indicated the estimation method as MLR in the command. 

I fit the same model in MPLUS where MLR is the default for a two-level analysis. In Mplus I get a warning that the dataset contains cases with missing values on all variables, which lavaan does not give me. 

I compared the output between lavaan and MPLUS. All of the test statistics differ. At level 1 the parameter estimates are the same in lavaan and in mplus. At level 2 the means are the same in lavaan as in mplus but the variances and covariances do not match. 

Why is this the case? I tried all different model specifications and changing estimators in the lavaan code but I cannot get the Test Statistics to align between the two programs?
How are the model specifications between lavaan and MPLUS different? Or is the problem the estimatior?

Has anyone had experience with comparing lavaan and MPLUS output for Multilevel, Multigroup CFA?

Thank you very much!!

Yves Rosseel

未読、
2020/06/03 14:24:342020/06/03
To: lav...@googlegroups.com
On 6/3/20 6:11 PM, Leoni wrote:
> I fit the same model in MPLUS where MLR is the default for a two-level
> analysis. In Mplus I get a warning that the dataset contains cases with
> missing values on all variables, which lavaan does not give me.

Did you use missing = "ml"? (Mplus does this by default, lavaan not).

If this doesn't solve it, can you show us the lavaan output and the
Mplus output?

Yves.


Leoni

未読、
2020/06/04 3:42:002020/06/04
To: lavaan
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)


Yves Rosseel

未読、
2020/06/05 3:12:262020/06/05
To: lav...@googlegroups.com
Hello Leoni,

I would like to investigate this further. Would you be able to send me
your data (or a snippet of the data) togehter with the Rscript and the
Mplus scripts?

In the meantime, I would suggest the following:

First extract the saturated (h1) values for the between level (per group):

lavInspect(results, "h1")[[2]]$cov

for the first group, and

lavInspect(results, "h1")[[4]]$cov

for the second group.

Then, use these values as starting values for the level: 2
variances/covariances, eg

relaxed ~~ start(150.020)*relaxed +
start(139.316)*happy +
start(115.834)*euphoric +
start(-139.878)*depressed +
start(-98.271)*stressed +
start(-82.996)*anxious +
start(-30.181)*anger

and so on...

Yves.
> --
> You received this message because you are subscribed to the Google
> Groups "lavaan" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to lavaan+un...@googlegroups.com
> <mailto:lavaan+un...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/lavaan/11a0ba95-016b-4341-a3b8-0d59ca68355a%40googlegroups.com
> <https://groups.google.com/d/msgid/lavaan/11a0ba95-016b-4341-a3b8-0d59ca68355a%40googlegroups.com?utm_medium=email&utm_source=footer>.
メッセージは削除されました

Lan Nguyen

未読、
2023/11/21 14:25:502023/11/21
To: lavaan

I also have the same problem when running a two-level model using MLR estimator in both lavaan and Mplus. 

All the test statistics, estimated coefficients, standard errors and p-value are so different. The Chi-square test in lavaan is higher than in M'plus, which indicated better goodness of fit. However, the SRMR within level in lavaan is much higher than in Mplus (0.092 vs 0.010). Lavaan's estimated coefficients are different but not much, but lavaan's SEs are much higher than what I found in Mplus, which leads to more insignificant effects. 

 

Also I received the message from lavaan which I did not see in Mplus:

3: In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats, : lavaan WARNING: The variance-covariance matrix of the estimated parameters (vcov) does not appear to be positive definite! The smallest eigenvalue (= -1.516512e-18) is smaller than zero. This may be a symptom that the model is not identified.

 

Could you please help me know why is it the case? Which one should be trusted?

 

Following is my lavaan's code and results

model_1<- '
      level: 1
      diet_ind ~ crop_indi + ploti + mktparti + inctrli
      crop_indi ~ ploti
      mktparti ~ crop_indi + inctrli
      inctrli ~ ploti
      veg_inc ~ mktparti + inctrli
      diet_ind ~~ 0*veg_inc

      level: 2
      crop_indi ~ sa + crop_com
      diet_ind ~ crop_indi + crop_com + diet_com
      crop_com ~ sa
      diet_com ~ crop_com + sa
      diet_com ~~ 0*crop_com
      diet_ind ~~ 0* crop_indi '
fit <- sem(model=model_1, data=sem_sa, cluster="vilid", estimator="MLR")


summary (fit, fit.measures=TRUE)

 

lavaan’s results

 

Estimator                                         ML

  Optimization method                           NLMINB

  Number of model parameters                        34

 

                                                  Used       Total

  Number of observations                          1150        1158

  Number of clusters [vilid]                        38           

 

Model Test User Model:

                                              Standard      Scaled

  Test Statistic                                 0.000       0.000

  Degrees of freedom                                 7           7

  P-value (Chi-square)                           1.000       1.000

  Scaling correction factor                                  0.837

    Yuan-Bentler correction (Mplus variant)                      

 

Model Test Baseline Model:

 

  Test statistic                               216.748     127.675

  Degrees of freedom                                25          25

  P-value                                        0.000       0.000

  Scaling correction factor                                  1.698

 

User Model versus Baseline Model:

 

  Comparative Fit Index (CFI)                    1.000       1.000

  Tucker-Lewis Index (TLI)                       1.130       1.243

                                                                 

  Robust Comparative Fit Index (CFI)                         1.000

  Robust Tucker-Lewis Index (TLI)                            1.120

 

Loglikelihood and Information Criteria:

 

  Loglikelihood user model (H0)              -7587.851   -7587.851

  Scaling correction factor                                 18.113

      for the MLR correction                                     

  Loglikelihood unrestricted model (H1)      -7719.755   -7719.755

  Scaling correction factor                                 15.163

      for the MLR correction                                     

                                                                 

  Akaike (AIC)                               15243.702   15243.702

  Bayesian (BIC)                             15415.318   15415.318

  Sample-size adjusted Bayesian (SABIC)      15307.323   15307.323

 

Root Mean Square Error of Approximation:

 

  RMSEA                                          0.000       0.000

  90 Percent confidence interval - lower         0.000       0.000

  90 Percent confidence interval - upper         0.000       0.000

  P-value H_0: RMSEA <= 0.050                    1.000       1.000

  P-value H_0: RMSEA >= 0.080                    0.000       0.000

                                                                 

  Robust RMSEA                                               0.000

  90 Percent confidence interval - lower                     0.000

  90 Percent confidence interval - upper                     0.000

  P-value H_0: Robust RMSEA <= 0.050                         1.000

  P-value H_0: Robust RMSEA >= 0.080                         0.000

 

Standardized Root Mean Square Residual (corr metric):

 

  SRMR (within covariance matrix)                0.092       0.092

  SRMR (between covariance matrix)               0.004       0.004

 

Parameter Estimates:

 

  Standard errors                             Sandwich

  Information bread                           Observed

  Observed information based on                Hessian

 

 

Level 1 [within]:

 

Regressions:

                   Estimate  Std.Err  z-value  P(>|z|)

  diet_ind ~                                         

    crop_indi         0.234    0.046    5.096    0.000

    ploti             0.052    0.048    1.080    0.280

    mktparti          0.047    0.044    1.085    0.278

    inctrli          -0.044    0.024   -1.800    0.072

  crop_indi ~                                        

    ploti             0.043    0.059    0.731    0.465

  mktparti ~                                         

    crop_indi         0.227    0.077    2.958    0.003

    inctrli           0.090    0.048    1.864    0.062

  inctrli ~                                          

    ploti            -0.137    0.033   -4.174    0.000

  veg_inc ~                                          

    mktparti          0.072    0.047    1.521    0.128

    inctrli           0.057    0.055    1.026    0.305

 

Covariances:

                   Estimate  Std.Err  z-value  P(>|z|)

 .diet_ind ~~                                         

   .veg_inc           0.000                         

Intercepts:

                   Estimate  Std.Err  z-value  P(>|z|)

   .mktparti         -0.000    0.001   -0.190    0.849

   .inctrli           0.001    0.001    0.955    0.340

   .veg_inc           0.000    0.000   12.363    0.000

 

Variances:

                   Estimate  Std.Err  z-value  P(>|z|)

   .diet_ind          0.549    0.051   10.706    0.000

   .crop_indi         0.638    0.112    5.684    0.000

   .mktparti          0.958    0.072   13.306    0.000

   .inctrli           0.981    0.066   14.818    0.000

   .veg_inc           0.997    0.965    1.033    0.302

Level 2 [vilid]:

Regressions:

                   Estimate  Std.Err  z-value  P(>|z|)

  crop_indi ~                                        

    sa                0.159    0.068    2.329    0.020

    crop_com          0.438    0.066    6.600    0.000

  diet_ind ~                                         

    crop_indi         0.994    0.248    4.012    0.000

    crop_com         -0.385    0.140   -2.747    0.006

    diet_com          0.414    0.056    7.366    0.000

  crop_com ~                                         

    sa                0.873    0.094    9.303    0.000

  diet_com ~                                          

    crop_com          0.467    0.104    4.485    0.000

    sa                0.481    0.110    4.388    0.000

 

Covariances:

                   Estimate  Std.Err  z-value  P(>|z|)

 .crop_com ~~                                         

   .diet_com          0.000                          

 .diet_ind ~~                                        

   .crop_indi         0.000                          

 

Intercepts:

                   Estimate  Std.Err  z-value  P(>|z|)

   .crop_indi         0.018    0.034    0.521    0.602

   .diet_ind         -0.004    0.031   -0.134    0.893

   .crop_com          0.004    0.089    0.047    0.963

   .diet_com         -0.016    0.060   -0.272    0.786

 

Variances:

                   Estimate  Std.Err  z-value  P(>|z|)

   .crop_indi         0.021    0.010    2.032    0.042

   .diet_ind          0.006    0.009    0.654    0.513

   .crop_com          0.303    0.063    4.806    0.000

   .diet_com          0.136    0.023    5.869    0.000

 

 

Following is the excerpt from my Mplus's outputs:

 THE MODEL ESTIMATION TERMINATED NORMALLY




MODEL FIT INFORMATION

Number of Free Parameters                       34

Loglikelihood

          H0 Value                       -6659.876
          H0 Scaling Correction Factor     18.1145
            for MLR
          H1 Value                       -6658.466
          H1 Scaling Correction Factor     15.1335
            for MLR

Information Criteria

          Akaike (AIC)                   13387.751
          Bayesian (BIC)                 13559.544
          Sample-Size Adjusted BIC       13451.549

            (n* = (n + 2) / 24)

Chi-Square Test of Model Fit

          Value                              4.306*
          Degrees of Freedom                     7
          P-Value                           0.7439
          Scaling Correction Factor         0.6549
            for MLR


*   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.000

CFI/TLI

          CFI                                1.000
          TLI                                1.000


Chi-Square Test of Model Fit for the Baseline Model

          Value                            502.160
          Degrees of Freedom                    25

          P-Value                           0.0000

SRMR (Standardized Root Mean Square Residual)

          Value for Within                   0.010
          Value for Between                  0.002




MODEL RESULTS

                                                    Two-Tailed
                    Estimate       S.E.  Est./S.E.    P-Value

Within Level

 DIET_IND   ON
    CROP_INDI          0.231      0.038      5.996      0.000
    PLOTI              0.064      0.030      2.146      0.032
    MKTPARTI           0.064      0.030      2.146      0.032
    INCTRLI           -0.148      0.040     -3.648      0.000

 CROP_INDI  ON
    PLOTI              0.067      0.022      2.995      0.003

 MKTPARTI   ON
    CROP_INDI          0.250      0.048      5.181      0.000
    INCTRLI            0.204      0.102      2.003      0.045

 INCTRLI    ON
    PLOTI             -0.060      0.015     -4.117      0.000

 VEG_INC    ON
    MKTPARTI           0.072      0.047      1.521      0.128
    INCTRLI            0.128      0.125      1.026      0.305

 DIET_IND WITH
    VEG_INC            0.000      0.000    999.000    999.000

 Intercepts
    MKTPARTI          -0.053      0.072     -0.744      0.457
    VEG_INC           -0.034      0.007     -5.041      0.000
    INCTRLI            0.264      0.025     10.469      0.000

 Residual Variances
    MKTPARTI           0.952      0.064     14.942      0.000
    VEG_INC            0.991      0.960      1.033      0.302
    INCTRLI            0.190      0.013     14.836      0.000
    CROP_INDI          0.637      0.115      5.553      0.000
    DIET_IND           0.550      0.052     10.646      0.000

Between Level

 CROP_INDI  ON
    SA                 0.139      0.067      2.063      0.039
    CROP_COM           0.430      0.066      6.529      0.000

 DIET_IND   ON
    CROP_INDI          0.893      0.220      4.064      0.000
    CROP_COM          -0.355      0.123     -2.874      0.004
    DIET_COM           0.425      0.052      8.118      0.000

 CROP_COM   ON
    SA                 0.847      0.091      9.303      0.000

 DIET_COM   ON
    CROP_COM           0.484      0.108      4.485      0.000
    SA                 0.483      0.110      4.389      0.000

 DIET_COM WITH
    CROP_COM           0.000      0.000    999.000    999.000

 DIET_IND WITH
    CROP_INDI          0.000      0.000    999.000    999.000

 Intercepts
    CROP_COM           0.000      0.086      0.000      1.000
    DIET_COM           0.000      0.060      0.000      1.000
    CROP_INDI          0.023      0.034      0.665      0.506
    DIET_IND           0.031      0.033      0.938      0.348

 Residual Variances
    CROP_COM           0.282      0.059      4.806      0.000
    DIET_COM           0.136      0.023      5.869      0.000
    CROP_INDI          0.022      0.011      2.007      0.045
    DIET_IND           0.004      0.008      0.477      0.634

New/Additional Parameters
    SAEFF              0.378      0.126      2.994      0.003
    MP                 0.016      0.008      2.005      0.045
    COM                0.215      0.039      5.444      0.000


QUALITY OF NUMERICAL RESULTS

     Condition Number for the Information Matrix              0.948E-08

       (ratio of smallest to largest eigenvalue)


Terrence Jorgensen

未読、
2023/11/22 7:22:112023/11/22
To: lavaan

I also have the same problem when running a two-level model using MLR estimator in both lavaan and Mplus.


If you used the default estimators, they are not the same.  Mplus uses an accelerated EM algorithm to obtain ML estimates, whereas lavaan uses a quasi-Newton algorithm.  Some technical details are provided here:


Terrence D. Jorgensen
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

Lan Nguyen

未読、
2023/11/23 14:12:372023/11/23
To: lavaan
Hi, 
I changed the Algorithm to EM in Mplus as suggested by the article, and also ran EM algorithm again with lavaan with MLR estimator to compare.  Interestingly,  with the EM algorithm, lavaan did not produce Scaled Test Statistics, and a scaling factor for Yuan-Bentler correction. The path coefficients were significantly larger with smaller SE, which leads to insignificance paths estimated by default algorithm becoming significant (!). Also, I received the warning "In lav_partable_check(lavpartable, categorical = lavoptions$.categorical, ... :
lavaan WARNING: automatically added intercepts are set to zero:"
Even though my data contains only continuous variables. 
 
Meanwhile, the Mplus results using EM did not change much to the default. This result is also similar to Bayes estimation in Mplus. I have tried Bayes because I am afraid that I have a small number of groups (38). It seems to me that my model does not have the forced convergence issue due to default Mplus settings for two-level models that the article suggests. Can I say that?

My lavaan code is:
fit <- sem(model=model_1, data=sem_sa, cluster="vilid", estimator="MLR", optim.method = "em", em.iter.max = 20000,
           em.fx.tol = 1e-08, em.dx.tol = 1e-04)

Many thanks.
Lan Nguyen.

Terrence Jorgensen

未読、
2023/11/24 4:51:542023/11/24
To: lavaan
lavaan's EM is quite slow (because R is slow).  Did you try telling Mplus to use QN instead of EM(A)?
メッセージは削除されました

Lan Nguyen

未読、
2023/11/27 10:05:022023/11/27
To: lavaan
Hi, 
I changed the algorithm in Mplus into QN, and I found the same results as using EM or EMA. Interestingly, the Chi-square test in lavaan is always 0, regardless of how I modify the model. It seems like a noise because the residuals matrices did not contain just 0 0. Does it signal some rechecks on multi-level function in lavaan? 

> summary(fit.robust2.test) lavaan 0.6.17.1955 ended normally after 62 iterations Estimator ML Optimization method NLMINB Number of model parameters 34 Used Total Number of observations 899 906 Number of clusters [vilid] 29 Model Test User Model: Test statistic 0.000 Degrees of freedom 12 P-value (Chi-square) 1.000 Parameter Estimates: Standard errors Standard Information Observed Observed information based on Hessian
> residuals(fit.robust2.test) $within $within$type [1] "raw" $within$cov dit_nd crop_i mkti inci veg_nc ploti ma_fi diet_ind -0.003 crop_i -0.003 -0.003 mkti -0.007 -0.016 0.000 inci -0.133 -0.094 0.001 0.000 veg_inc -0.007 -0.043 0.000 0.000 0.000 ploti 0.219 0.236 0.004 0.000 0.028 0.000 ma_fi -0.117 -0.125 -0.002 -0.013 0.010 0.000 0.000 $within$mean diet_ind crop_i mkti inci veg_inc ploti ma_fi -0.005 -0.002 0.000 0.000 0.000 0.000 0.000 $vilid $vilid$type [1] "raw" $vilid$cov crop_i dit_nd crp_cm dit_cm sa crop_i 0.001 diet_ind 0.007 0.010 crop_com -0.003 -0.002 0.000 diet_com 0.012 0.008 0.000 0.000 sa 0.040 0.041 0.000 0.000 0.000 $vilid$mean crop_i diet_ind crop_com diet_com sa 0.002 0.006 0.000 0.000 0.000
全員に返信
投稿者に返信
転送
新着メール 0 件