Error with invariance testing

41 views
Skip to first unread message

Micah N

unread,
Aug 16, 2022, 11:44:06 AM8/16/22
to lavaan
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

Terrence Jorgensen

unread,
Sep 1, 2022, 8:08:38 AM9/1/22
to lavaan
the problem arises when I try to incorporate complex survey design characteristics using lavaan.survey

That package does not work with categorical outcomes.

Terrence D. Jorgensen
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

Reply all
Reply to author
Forward
0 new messages