No fit indices multilevel CFA displayed in lavaan output

39 views
Skip to first unread message

Mirjam Moerbeek

unread,
Mar 4, 2026, 6:37:38 AM (7 days ago) Mar 4
to lav...@googlegroups.com

Hello everybody,

I am fitting a sequence of multilevel CFA models using lavaan. Following chapter 14 of the book Multilevel analysis by Hox, Moerbeek and van de Schoot, I first fit three benchmark models. When I fit the null model (all item variances at level-2 fixed to zero) then lavaan produces the same parameter estimates and standard error as Mplus, but all fit indices are NA. The weird thing is fit indices are displayed when I fit the independence model (with non-zero item variances at level-2 but zero item-covariances at level-2) and the saturated model (with non-zero variances and covariances at level-2).

The data I am using are from chapter 7 of the book by Heck, Thomas and Tabata and can be downloaded from the support material at this website: https://www.routledge.com/Multilevel-and-Longitudinal-Modeling-with-IBM-SPSS/Heck-Thomas-Tabata/p/book/9780367424619

 

My lavaan syntax is as follows


library(haven)

library(lavaan)

WorkLife <- read_sav("ch7ex2constructs.sav")

 

model1a <- '

level: 1

worklife      =~ 1*W1varied + W2value + W3team

productivity  =~ 1*P1assess + P2progress + P3evstand

worklife ~~ NA*worklife

productivity ~~ NA*productivity

 

level: 2

W1varied ~~ 0*W1varied

W2value ~~ 0*W2value

W3team ~~ 0*W3team

P1assess ~~ 0*P1assess

P2progress ~~ 0*P2progress

P3evstand ~~ 0*P3evstand

'

 

fit1a <- sem(model   = model1a,

             data    = WorkLife,

             cluster = "group",

             std.lv  = TRUE,

             verbose = FALSE)

 

fitMeasures(fit1a)

summary(fit1a, fit.measures = FALSE)

 

How do I get the fit indices to be displayed in the output? Any help would be greatly appreciated!

Thanks in advance,

Mirjam Moerbeek

Sunday Ogbu

unread,
Mar 4, 2026, 7:56:22 AM (7 days ago) Mar 4
to lav...@googlegroups.com
Set fit.measures =True 

--
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 visit https://groups.google.com/d/msgid/lavaan/CAFPdW3VEK%2BMPQnT4ctp3cFM7Jxq98bU43FffrUMoS2KPSrtQOQ%40mail.gmail.com.

Mirjam Moerbeek

unread,
Mar 4, 2026, 8:14:49 AM (7 days ago) Mar 4
to lavaan
Dear Sunday,
Thanks for your reply. The second last line in my code requests the fit indices to be printed, but as you can see from the output below it does not give any values but NA. My question is how I get the values of the fit indices.
Thanks,
Mirjam


> fitMeasures(fit1a) npar fmin chisq df pvalue 19.000 1.909 NA 29.000 NA baseline.chisq baseline.df baseline.pvalue cfi tli NA NA NA NA NA nnfi rfi nfi pnfi ifi NA NA NA NA NA rni logl unrestricted.logl aic bic NA NA -4722.932 NA NA ntotal bic2 rmsea rmsea.ci.lower rmsea.ci.upper 650.000 NA NA NA NA rmsea.ci.level rmsea.pvalue rmsea.close.h0 rmsea.notclose.pvalue rmsea.notclose.h0 0.900 NA 0.050 NA 0.080 srmr srmr_within srmr_between NA 0.050 NA

Op woensdag 4 maart 2026 om 13:56:22 UTC+1 schreef sunda...@unn.edu.ng:

yros...@gmail.com

unread,
Mar 4, 2026, 10:49:00 AM (7 days ago) Mar 4
to lav...@googlegroups.com
> three benchmark models. When I fit the null model (all item variances at level-2
> fixed to zero) then lavaan produces the same parameter estimates and standard
> error as Mplus, but all fit indices are NA

Ha, I think I know what the problem is. Since 0.6-20, lavaan checks for model-implied Sigma matrices that are all zero, and switches off the computation of the loglikelihood for that block. Seemed like a reasonable thing to do at the time... But in your model, the model-implied Sigma for level-2 is just the zero matrix, and this triggers the Nas for the fit indices.

Simple solution: replace one of the zeroes by a very small but nonzero value, for example:

W1varied ~~ 0.00001*W1varied

Yves.


Mirjam Moerbeek

unread,
Mar 5, 2026, 2:03:14 AM (6 days ago) Mar 5
to lavaan
Dear Yves,
Thanks for the help and adding a very small non-zero value did the trick. I now get values for all fit indices.

Keep on the good work with lavaan!

Best,
Mirjam

Op woensdag 4 maart 2026 om 16:49:00 UTC+1 schreef yros...@gmail.com:
Reply all
Reply to author
Forward
0 new messages