different results in Mplus and R?

372 views
Skip to first unread message

Anne Stöcker

unread,
Sep 23, 2019, 7:18:26 AM9/23/19
to lavaan
Hi everyone,

I apologize in avance since I'm rather new to R. I can't figure out, why my advisor gets different results (cfi etc) than me for the (supposedly) same models.

She uses Mplus and I use R. We both did a CFA or rather several CFAs and her results e.g. for cfi are substantially higher.

Example:

Mplus:

MODEL:

  Dispo BY beh1 beh4 beh7 beh10 beh13;

  Funk BY beh2 beh5 beh8 beh11 beh14 beh16;


--> CFI .945

If I ask for

model <- '
    dispo  =~ beh1 + beh4 + beh7 + beh10 + beh13
funkt  =~ beh2 + beh5 + beh8 + beh11 + beh14 + beh16
'

fit <- cfa(model, data = Meme_erw, estimator= "MLR") # she used MLR in Mplus
summary(fit, fit.measures = TRUE, standardized = TRUE)
fitMeasures(fit)

--> cfi  0.859, cfi.robust 0.887


I would be very thankful for your help!

Anne

Mauricio Garnier-Villarreal

unread,
Sep 23, 2019, 2:55:28 PM9/23/19
to lavaan
can you share your full Mplus code?

my best guess so far is that in Mplus the variables are treated as categorical, and in lavaan you are treating them as continuous

Jeremy Miles

unread,
Sep 24, 2019, 4:20:09 PM9/24/19
to lav...@googlegroups.com
Are the model estimates the same? Are the df the same?



--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/2dec3b7f-0656-4028-a6e8-0d1a30fc8bae%40googlegroups.com.

Anne

unread,
Sep 25, 2019, 2:29:03 AM9/25/19
to lavaan

VARIABLE: NAMES ARE beh1 beh2 beh3 

            beh4 beh5 beh6_r beh7 beh8

            beh9_r beh10 beh11 beh12_r

            beh13 beh14 beh15_r beh16

            beh6 beh9 beh12 beh15;

           

             MISSING ARE ALL (999);

           

             USEVARIABLES ARE beh1 beh2

             beh4 beh5 beh7 beh8 beh11

             beh10 beh13 beh14 beh16; 

             

ANALYSIS: ESTIMATOR = MLR;

 

MODEL:

Dispo BY beh1 beh4 beh7 beh10 beh13;

Funk BY beh2 beh5 beh8 beh11 beh14 beh16;

 

OUTPUT: stdyx modindices(3.84);

 


Here is the code. My advisor didn't specify the variables as categorical, she says. Could that have happened to me somehow?
(By the way I excluded 999 beforehand, no worries there.)

Anne

unread,
Sep 25, 2019, 2:35:47 AM9/25/19
to lavaan
We both used MLR ...I hope. When I added the estimator in R, I got the robust results.

I have 43 df, will post her answer as soon as I get it.
To unsubscribe from this group and stop receiving emails from it, send an email to lav...@googlegroups.com.

Garett Howardson

unread,
Sep 25, 2019, 6:40:38 AM9/25/19
to lavaan
I believe Mplus uses different baseline or null models for the incremental fit indices. If memory serves, Mplus uses a saturated model as the baseline for incremental fit indices. I can't recall off-hand what lavaan uses but if it uses the independence model for baseline, that could be why you are observing differences between the software. 

Mauricio Garnier-Villarreal

unread,
Sep 27, 2019, 12:42:53 AM9/27/19
to lavaan
Anne

can you show the full fit indices and parameters from bothe Mplus and lavaan?

Anne

unread,
Sep 27, 2019, 3:02:00 AM9/27/19
to lavaan
I will look into it, thank you very much. I need a couple of days due to other obligations.

Anne

unread,
Sep 27, 2019, 3:03:04 AM9/27/19
to lavaan
I a couple of days, I'm at a conference and my advisor is in another country ;-) Working on it, thank you!

Anne

unread,
Sep 29, 2019, 3:51:12 PM9/29/19
to lavaan
Mplus also has 43 df.

Anne

unread,
Sep 29, 2019, 3:54:40 PM9/29/19
to lavaan
Mplus:

MODEL FIT INFORMATION

 

Number of Free Parameters                       34

 

Loglikelihood

 

          H0 Value                       -1712.091

          H0 Scaling Correction Factor      1.3448

            for MLR

          H1 Value                       -1672.416

          H1 Scaling Correction Factor      1.3490

            for MLR

 

Information Criteria

 

          Akaike (AIC)                    3492.182

          Bayesian (BIC)                  3590.197

          Sample-Size Adjusted BIC        3482.655

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

 

Chi-Square Test of Model Fit

 

          Value                             58.681*

          Degrees of Freedom                    43

          P-Value                           0.0559

          Scaling Correction Factor         1.3522

            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.053

          90 Percent C.I.                    0.000  0.084

          Probability RMSEA <= .05           0.424

 

CFI/TLI

 

          CFI                                0.945

          TLI                                0.930

 

Chi-Square Test of Model Fit for the Baseline Model

 

          Value                            341.759

          Degrees of Freedom                    55

          P-Value                           0.0000

 

SRMR (Standardized Root Mean Square Residual)

 

          Value                              0.059




R:



> fitMeasures(fit)
                         npar                          fmin                         chisq                            df                        pvalue                  chisq.scaled 
                       23.000                         0.416                        94.095                        43.000                         0.000                        73.181 
                    df.scaled                 pvalue.scaled          chisq.scaling.factor                baseline.chisq                   baseline.df               baseline.pvalue 
                       43.000                         0.003                         1.286                       418.029                        55.000                         0.000 
        baseline.chisq.scaled            baseline.df.scaled        baseline.pvalue.scaled baseline.chisq.scaling.factor                           cfi                           tli 
                      304.312                        55.000                         0.000                         1.374                         0.859                         0.820 
                         nnfi                           rfi                           nfi                          pnfi                           ifi                           rni 
                        0.820                         0.712                         0.775                         0.606                         0.864                         0.859 
                   cfi.scaled                    tli.scaled                    cfi.robust                    tli.robust                   nnfi.scaled                   nnfi.robust 
                        0.879                         0.845                         0.887                         0.855                         0.845                         0.855 
                   rfi.scaled                    nfi.scaled                    ifi.scaled                    rni.scaled                    rni.robust                          logl 
                        0.692                         0.760                         0.885                         0.879                         0.887                     -1455.389 
            unrestricted.logl                           aic                           bic                        ntotal                          bic2             scaling.factor.h1 
                           NA                      2956.779                      3019.509                       113.000                      2946.817                         1.404 
            scaling.factor.h0                         rmsea                rmsea.ci.lower                rmsea.ci.upper                  rmsea.pvalue                  rmsea.scaled 
                        1.624                         0.103                         0.074                         0.131                         0.002                         0.079 
        rmsea.ci.lower.scaled         rmsea.ci.upper.scaled           rmsea.pvalue.scaled                  rmsea.robust         rmsea.ci.lower.robust         rmsea.ci.upper.robust 
                        0.050                         0.106                         0.048                         0.089                         0.052                         0.124 
          rmsea.pvalue.robust                           rmr                    rmr_nomean                          srmr                  srmr_bentler           srmr_bentler_nomean 
                           NA                         0.060                         0.060                         0.076                         0.076                         0.076 
                         crmr                   crmr_nomean                    srmr_mplus             srmr_mplus_nomean                         cn_05                         cn_01 
                        0.083                         0.083                         0.076                         0.076                        72.218                        82.013 
                          gfi                          agfi                          pgfi                           mfi                          ecvi 
                        0.867                         0.795                         0.565                         0.798                         1.240 

Am Freitag, 27. September 2019 06:42:53 UTC+2 schrieb Mauricio Garnier-Villarreal:

Jeremy Miles

unread,
Sep 30, 2019, 1:14:45 PM9/30/19
to lav...@googlegroups.com

Your chi-squares are different, as are your null model chi-squares (and scaling correction factor).

Double check your samples are the same. In  Mplus, use:

analysis:
      type = basic;

In R, summary(data_frame_name)

Check you have the same means, sample sizes, standard deviations, etc.

Jeremy



--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/5d1762f0-2da3-4d9f-9f0a-b9f61c90c9b2%40googlegroups.com.

Alex Schoemann

unread,
Sep 30, 2019, 1:52:22 PM9/30/19
to lavaan
The two programs are estimating different numbers of parameters (34 in Mplus and 23 in lavaan). There are a number of reasons why this might occur (e.g. indicators are treated as categorical in Mplus but continuous in lavaan, exogenous predictors are treated as random in Mplus but fixed in lavaan). Working out this discrepancy will likely provide insight.

Alex
To unsubscribe from this group and stop receiving emails from it, send an email to lav...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages