Hi,
I am working on measurement invariance analysis using semTools to create syntax for multi-group CFA with categorical indicators (MI across biological sex, 2 groups).
I have been using the very useful measEq.syntax-function until now. However. since beginning of March I cannot execute my syntax anymore. I have tried a lot of troubleshooting options (see below) - none worked.
Here is example code and exemplary error presentation:
fit <- measEq.syntax(configural.model =
mod.cat, data = df_mi_parent,
ordered = c("item1", "item2", "item3", ...., "item25"),
group = "sex",group.label=c("1", "2"),
estimator ="DWLS",
test = "scaled.shifted",
se = "robust",
parameterization = "theta",
ID.fac = "
std.lv", ID.cat = "Wu.Estabrook.2016",
group.equal = "thresholds")
# Runs perfectly
summary(syntax.thresh) # summarize model features
Length Class Mode
1 measEq.syntax S4
mod.thresh <- as.character(syntax.thresh) # save as text
Error in as.character.default(syntax.thresh) :
no method for coercing this S4 class to a vector
cat(mod.thresh) # print/view lavaan syntax
# cannot be executed since line above was aborted.
I have attempted the following troubleshooting approaches. Unfirtunately, all have been unsuccessful.
1. updated R, lavaan and semTools
I would highly appreciate some help on how to overcome the S4 issue. I am not an R-programmer and therefore have a limited understanding of the S3/S4 classesd/objects. I am an applied researcher - Hence, I appreciate any help I solve the issue using semTools or any workaround.
Thanks in advance, I am happy to provide more information or code and hope this follows the community guidelines.
Best
Claudia