compareFit(..., nested = TRUE)
lavaan
outputs or lists of lavaan
outputsFitDiff
object that saves model fit comparisons across multiple models. If the output is not assigned as an object, the output is printed in two parts: 1) nested model comparison (if models are nested) and 2) fit indices summaries. In the fit indices summaries, daggers are tagged to the model with the best fit for each fit index.FitDiff
, clipboard
m1 <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '
fit1 <- cfa(m1, data=HolzingerSwineford1939)
m2 <- ' f1 =~ x1 + x2 + x3 + x4
f2 =~ x5 + x6 + x7 + x8 + x9 '
fit2 <- cfa(m2, data=HolzingerSwineford1939)
compareFit(fit1, fit2, nested=FALSE)
HW.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '
out <- measurementInvariance(HW.model, data=HolzingerSwineford1939, group="school", quiet=TRUE)
compareFit(out)
Run the code above in your browser using DataLab