Description Usage Arguments Examples
View source: R/cfa_invariance_test.r
This function creates a data frame that display a classical Chisqare-test of differently configured SEM/CFA models. This function is similarly written as cfa_invariance_fit
. Both functions are meant to be used together.
1 | cfa_invariance_test(..., model_names = NULL, print = FALSE)
|
... |
Objects objects of class |
model_names |
Do you want to rename the models? Provide a vector with the respective model names. |
print |
A logical value indicating whether table shoud be formatted according to APA-guidelines. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | library(lavaan)
d <- PoliticalDemocracy %>% na.omit
model_1 <- '
# latent variables
ind60 =~ x1 + x2 + x3
dem60 =~ y1 + y2 + y3 + y4
dem65 =~ y5 + y6 + y7 + y8
'
fit_1 <- cfa(model_1, data = d)
model_2 <- '
# latent variables
ind60 =~ x1 + x2 + x3
dem60 =~ y1 + y2 + y3
dem65 =~ y5 + y6 + y7 + y8
'
fit_2 <- cfa(model_2, data = d)
# Model comparison
cfa_invariance_test(fit_1, fit_2)
# Renaming model names
cfa_invariance_test(fit_1, fit_2, model_names = c("Model 1: All variables", "Model 2: Some omissions"), print = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.