Hello everyone,
I am having some trouble sorting out an error I am getting when performing measurement invariance testing. I am using measEQ.syntax in semTools and the problem arises when I try to incorporate complex survey design characteristics using lavaan.survey. Here's the code I ran:
model <- '
latent =~ v1 + v2 + v3 + v4 + v5 + v6
v1 ~~ v6
v5 ~~ v6
'
baseline <- measEq.syntax(configural.model = model,
data = data,
ordered = c("v1", "v2", "v3", "v4",
"v5", "v6"),
parameterization = "delta",
ID.fac = "std.lv",
ID.cat = "Wu.Estabrook.2016",
group = "group",
group.equal = "configural")
model_baseline <- as.character(baseline)
fit_baseline <- cfa(model = model_baseline, data = data, group = "group", ordered = c("v1", "v2", "v3", "v4", "v5", "v6"))
This code works and summary(fit_baseline) provides error free results. But the error occurs when I try to account for the survey design:
survey_weight <- svydesign(ids = ~psu, strata = ~strata, weights = ~weight, data = data, nest = TRUE)
fit_baseline_surv <- lavaan.survey(lavaan.fit = fit_baseline, survey.design = survey_weight, estimator = "DWLS")
Error in start[th.idx] <- th.values[match(th.names.lavpartable, th.names.sample)] :
replacement has length zero
Any ideas about how I could fix this issue?
Thanks for your help,
Micah