library(lavaan)
# For illustration, only one factor is used,
# with one item from another factor added
# just to make the model not saturated.
HSmod <-
"
spatial =~ x1 + x2 + x3 + x4
"
fit_config <- cfa(model = HSmod,
data = HolzingerSwineford1939,
group = "school")
fit_mi <- measurement_invariance_models(fit_config)
names(fit_mi)
# Need to add 'skip_check_sem_out = TRUE' to use multigroup models.
out <- model_set(sem_out = fit_mi,
skip_check_sem_out = TRUE,
progress = FALSE,
parallel = FALSE)
print(out)
Run the code above in your browser using DataLab