yrosseel / lavaan

an R package for structural equation modeling and more
http://lavaan.org
429 stars 98 forks source link

GFI of baseline model #245

Closed fenglinhuoshan123 closed 1 year ago

fenglinhuoshan123 commented 1 year ago

I find that in AMOS(SPSS) the SEM result also gives GFI of baseline model. I really want to get this index, but found a bit difficulty for me to read about wls_obs object etc. Is there any way to generate baseline model GFI according the current fit parameters which can be easily extracted Tks!

TDJorgensen commented 1 year ago

You can fit any null model of interest, but the default independence-model specification can be obtained from the lav_partable_independence() function.

mod.null <- lav_partable_independence(fit)
fit.null <- lavaan(mod.null, data = HolzingerSwineford1939)
fitMeasures(fit.null, "gfi")