I am having a very strange experience with the Lavaan (v0.5-20 R v3.1) degrees of freedom calculation. In short, the calculation of df inside of the cfa function and measurement seems to be happening independent of sample size.
In more detail, I have a data set (n=1595) that I am fitting to a CFA model (see code below). Fitting the full dataset returns a df of 729. Fitting that model by group using the cfa function and ‘group’ argument doubles the df, as I expect, to 1458 and using the ‘measurementInvariance’ command fits a configural model with 1458 df which progresses to a df of 1578 as I would expect with the more constrained strict invariance model. In sum, when the model is fitted to the full dataset, everything operates as I would expect.
However, my research partner and I decided to test the measurement model with equal sample sizes to compare among two groups (nmale=1211 and nfemale=384). We randomly sampled from male population 384 times. We then reran the exact same model using the new data set. Strangely (to me) the df numbers at every step (i.e., simple cfa, cfa by group, and measurementInvariance) exactly match those that were calculated for the full data set. The test statistic changes, as one would expect, but the df values remain at 729 for the basic model no matter what sample size I throw at it.
I have done a bunch of trouble shooting including splitting the data set outside of R just as a sanity check with no change in result. I feel like there must be something about the df calculation that I do not understand, but I also am confused by how changing the sample size cannot change the degrees of freedom for the same model/number of free parameters. A simplified (but notably rough) version of the code is attached which also contains trimmed results from running it. I also included a very parsimonious version of the relevant results below
What I am missing?
Todd
===
Full Sample
> summary(DATA_gender_full$Gender)
Male Female
1211 384
> summary(cfa_gender_full)
Estimator ML
Minimum Function Test Statistic 3446.453
Degrees of freedom 729
> summary(cfa_gender_full_groups)
Estimator ML
Minimum Function Test Statistic 4383.211
Degrees of freedom 1458
Chi-square for each group:
Male 2689.297
Female 1693.914
Reduced Sample
> summary(DATA_gender_reduced$Gender)
Male Female
384 384
> summary(cfa_gender_reduced)
Estimator ML
Minimum Function Test Statistic 2181.862
Degrees of freedom 729
> summary(cfa_gender_reduced_groups)
Estimator ML
Minimum Function Test Statistic 3126.600
Degrees of freedom 1458
Chi-square for each group:
Male 1432.686
Female 1693.914
--
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 post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.