cfa_dat_mg | R Documentation |
A six-variable dataset with 100 cases.
cfa_dat_mg
A data frame with 100 rows and 6 variables:
Indicator. Numeric.
Indicator. Numeric.
Indicator. Numeric.
Indicator. Numeric.
Indicator. Numeric.
Indicator. Numeric.
Group variable. Character. Either "GroupA" or "GroupB".
library(lavaan)
data(cfa_dat_mg)
mod <-
"
f1 =~ x1 + x2 + x3
f2 =~ x4 + x5 + x6
"
fit1 <- cfa(mod, cfa_dat_mg, group = "gp")
fit2 <- cfa(mod, cfa_dat_mg, group = "gp",
group.equal = "loadings")
fit3 <- cfa(mod, cfa_dat_mg, group = "gp",
group.equal = c("loadings", "intercepts"))
lavTestLRT(fit1, fit2, fit3)
lavTestLRT(fit1, fit3)
# Drop the first case
cfa_dat_mgb <- cfa_dat_mg[-1, ]
fit1b <- cfa(mod, cfa_dat_mgb, group = "gp")
fit2b <- cfa(mod, cfa_dat_mgb, group = "gp",
group.equal = "loadings")
fit3b <- cfa(mod, cfa_dat_mgb, group = "gp",
group.equal = c("loadings", "intercepts"))
lavTestLRT(fit1b, fit2b, fit3b)
lavTestLRT(fit1b, fit3b)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.