I want to use lavaan survey package to build a model. My exogenous categorical variables contain some binary and categorical variables. My endogenous variables are categorical variables. Following the instruction, after weighted my data, I first fit a SEM with lavaan. Then I use lavaan.survey package. My question is that it seems lavaan can deal with categorical variable with WLSMV estimator; but the lavaan.survey package can't. The output still shows the ML estimator when using the lavaan.survey. So I was wondering, how to handle categorical variables when using lavaan.survey package. Below is my syntax. Any help will be appreciated. Thank you.
#Tell R that some variables are categorical/ordinal
hfda[,c("H_S",
"A_S",
"20Times",
"Now")] <-
lapply(hfda[,c("H_S",
"A_S",
"20Times",
"Now")], ordered)
model4 <- 'H_S~T+r+i+R
A_S~T+r+i+R
20Times~H_S+A_S+Age+S100+Edu+Fri+Whites+Nonwhites
Now~Ha_S+A_S+Age+S100+Edu+Fri+Whites+Nonwhites
20Times~~Now
H_S~~A_S'
fit <- lavaan(model5, data = hfda, auto.var = TRUE,
std.lv = TRUE,
meanstructure = TRUE, int.ov.free = TRUE)
fit
summary(fit)
fit.survey<-lavaan.survey(lavaan.fit = fit, survey.design = whfda)
fit.survey
summary(fit.survey,fit.measures=TRUE,standardize=TRUE,modindices = TRUE)