How to deal with ordinal categorical variable in lavaan.survey package

1,518 views
Skip to first unread message

ZXM

unread,
Jul 11, 2016, 6:10:53 PM7/11/16
to lavaan
Dear all, 

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)

ZXM

unread,
Jul 11, 2016, 6:16:33 PM7/11/16
to lavaan
It also has an error message as following after running the lavaan.survey. 

Error in lav_model_estimate(lavmodel = lavmodel, lavsamplestats = lavsamplestats,  : 
  lavaan ERROR: initial model-implied matrix (Sigma) is not positive definite;
  check your model and/or starting parameters.

Yves Rosseel

unread,
Jul 13, 2016, 3:07:12 AM7/13/16
to lav...@googlegroups.com
On 07/12/2016 12:10 AM, ZXM wrote:
> when using the lavaan.survey. So I was wondering, how to handle
> categorical variables when using lavaan.survey package.

I am afraid that lavaan.survey does not handle categorical (endogenous)
variables.

I would use Mplus for this.

Yves.

ZXM

unread,
Jul 13, 2016, 10:21:40 AM7/13/16
to lavaan
Thank you Yves for your reply. I have a related follow up question. If my endogenous variables are recorded on a 1-4  likert scale. Could I treat it as continuous variable and use the estimator = "ML" in lavaan survey? Thank you!

Terrence Jorgensen

unread,
Jul 13, 2016, 10:46:00 AM7/13/16
to lavaan
If my endogenous variables are recorded on a 1-4  likert scale. Could I treat it as continuous variable and use the estimator = "ML" in lavaan survey? 

No, not without highly undesirable consequences:


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

ZXM

unread,
Jul 13, 2016, 11:46:59 AM7/13/16
to lavaan
Thank you, Terrence. But it seems that Mplus doesn't provide fit statistics when using JK1 replicate weights. I guess my problem is that I have a national data with JK1 replicate weights. I have four endogenous variables which are measured with likert scale, two on 4-point scale and the other two on 5-point scale. I'd like to run a path analysis on them. It seems both softwares (Mpluse or lavaan survey) couldn't satisfy my data requirement. Is there any other idea to handle this situation? Thank you. 

Terrence Jorgensen

unread,
Jul 14, 2016, 8:59:00 AM7/14/16
to lavaan
Thank you, Terrence. But it seems that Mplus doesn't provide fit statistics when using JK1 replicate weights. I guess my problem is that I have a national data with JK1 replicate weights. I have four endogenous variables which are measured with likert scale, two on 4-point scale and the other two on 5-point scale. I'd like to run a path analysis on them. It seems both softwares (Mpluse or lavaan survey) couldn't satisfy my data requirement. Is there any other idea to handle this situation? 

In Mplus, you can specify your outcomes as ordinal and estimate either a probit or logistic regression to predict your outcomes.  The probit approach would be equivalent to predicting the latent normal variables that you assume underlie the observed ordinal variables.  You can post further questions on the Mplus forum or on SEMNET:


Reply all
Reply to author
Forward
0 new messages