View source: R/cfa_invariance_fit.r
1 | cfa_invariance_fit(..., model_names = NULL, print = FALSE)
|
... |
Lavaan fit objects (e.g., with base, weak, strong and strict invariance constraints). |
model_names |
If desired, this argument can be used to pass a character vector to the function containing new names for the models (the vector's length needs to equal the number of models!). |
print |
Logical value indicating whether the output should be formatted according to APA guidelines. #' @return A data frame including one row per model that was passed to the function. The output includes the most commonly reported fit indices for structural equation models. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | library(lavaan)
model_1 <- '
# latent variables
ind60 =~ x1 + x2 + x3
dem60 =~ y1 + y2 + y3 + y4
dem65 =~ y5 + y6 + y7 + y8
'
fit_1 <- cfa(model_1, data = PoliticalDemocracy)
model_2 <- '
# latent variables
ind60 =~ x1 + x2 + x3
dem60 =~ y1 + y2 + y3
dem65 =~ y5 + y6 + y7 + y8
'
fit_2 <- lavaan::cfa(model_2, data = PoliticalDemocracy)
# Model comparison
cfa_invariance_fit(fit_1, fit_2)
cfa_invariance_fit(fit_1, fit_2,
model_names = c("M1", "M2"),
print = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.