number of parameters different mplus vs. r

132 views
Skip to first unread message

Chuck Meitner

unread,
Feb 20, 2021, 3:11:31 PM2/20/21
to lavaan
Hi

I'm trying to make the switch from Mplus over to R.  To help me learn, I ran the same model in both packages.  Most of my loadings, correlations, etc. were REALLY close but I noticed my degrees of freedom and free parameters were different (more in R) and my fit statistics were all different by a little bit.  Does R and Mplus calculate degrees of freedom differently?

Thanks
R-noob


Mauricio Garnier-Villarreal

unread,
Feb 21, 2021, 7:06:26 AM2/21/21
to lavaan
The df should be the same. Are you sure you estimated the models exactly the same?
Where I have seen some differences is with categorical items, because Mplus hides what they actually do

If you need more helps, you need to provide detail information. Like the lavaan and mplus syntax, and outputs. Its very hard to say where a difference might be from such a general comment

Sedat Şen

unread,
Feb 21, 2021, 7:11:47 AM2/21/21
to lav...@googlegroups.com
Yes, Mplus calculates df different than R. Mplus also takes intercepts (factor means) into account. As far as I know intercept is the difference between Mplus and other software packages. 

--
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/c47218e7-7c9a-4153-80a3-45d3e6bea01dn%40googlegroups.com.
Message has been deleted

Chuck Meitner

unread,
Feb 21, 2021, 10:14:57 AM2/21/21
to lavaan
I figured it out.  Thanks for your assistance.  I'd included a couple more predictors in Lavaan that weren't there in Mplus.  Stupid mistake on my part.  Sorry to bother you.

car...@web.de

unread,
Feb 21, 2021, 2:12:33 PM2/21/21
to lav...@googlegroups.com
Well, if you use a different number of indicators, it can't really surprise you, can it?
Am 21.02.21, 19:57 schrieb Chuck Meitner <chuck....@gmail.com>:
Thank you for your response.  Below is the relevant syntax for Mplus and Lavaan using the same dataset.  Both used FIML and MLR.

Mplus:
MODEL:
SA by S1 S2 S3 S4 S5 S6;
IP by I1 I2 I3 I4 I5 I6;
CP by C1 C2 C3 C4;
AL by A1 A2 A3;
BL by B1 B2 B3 B4;

ANALYSIS: ESTIMATOR = MLR;
OUTPUT: STDYX;

Mplus shows Free Parameters=79, Chisq df=220; RMSEA .050; CFI .97; TLI .965; SRMR .028

Lavaan:
MyModel <- '
     SA =~ S1 + S2 + S3 + S4 + S5 + S6
     IP =~ I1 + I2 + I3 + I4 + I5 + I6
     CP =~ C1 + C2 + C3 + C4
     AL =~ A1 + A2 + A3 + A4
     BL =~ B1 + B2 + B3 + B4 + B5 + B6
'
fit<- cfa(MyModel, data=MyData, missing="ml", estimator="MLR")
summary(fit, fit.measures=TRUE, standardized=TRUE)

Lavaan shows Free Parameters = 88; Chisq df=289; RMSEA .055; CFI .959; TLI .954; SRMR .036

The standardized loadings are the same for both programs although the understandardized Z-scores are off every so slightly.  If I remember right, I read somewhere that Mplus uses n-1 instead of n so on a large sample like mine they'd be really close but not exact.  

Thanks for any help you could throw me.




On Sunday, February 21, 2021 at 7:06:26 AM UTC-5 mauga...@gmail.com wrote:
The df should be the same. Are you sure you estimated the models exactly the same?
Where I have seen some differences is with categorical items, because Mplus hides what they actually do

If you need more helps, you need to provide detail information. Like the lavaan and mplus syntax, and outputs. Its very hard to say where a difference might be from such a general comment



On Saturday, February 20, 2021 at 9:11:31 PM UTC+1 chuck....@gmail.com wrote:
Hi

I'm trying to make the switch from Mplus over to R.  To help me learn, I ran the same model in both packages.  Most of my loadings, correlations, etc. were REALLY close but I noticed my degrees of freedom and free parameters were different (more in R) and my fit statistics were all different by a little bit.  Does R and Mplus calculate degrees of freedom differently?

Thanks
R-noob


--
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.
Reply all
Reply to author
Forward
0 new messages