I have estimated a mediator path model with only observed (no latent) variables and a dichotomous outcome variable using the lavaan
package in R (default estimator for ordered endogenous variables = WLSMV). The model consists of a categorical predictor with 3 categories (two dummy variables), three continuous mediators, and a dichotomous outcome.
As my data is clustered, I would like to obtain cluster robust standard errrors. For ordered endogenous variables, this option using the cluster argument within lavaan
is currently not supported.
Is there a way to obtain clustered SE’s using sandwich
vcovCL
based on the lavaan
output?
I have tried using sandwich
with lmtest
as decribed here, but that does not work for the lavaan
model.
My model is specified as follows:
model <- '
# direct paths from x to mediators
m1 ~ a1*Class1 + a2*Class2
m2 ~ a3*Class1 + a4*Class2
m3 ~ a5*Class1 + a6*Class2
# direct paths from x to y
y ~ c1*Class1 + c2*Class2
# direct paths from mediator to y
y ~ b1*m1 + b2*m2 + b3*m3
# indirect paths
a1b1 := a1*b1
a2b1 := a2*b1
a3b2 := a3*b2
a4b2 := a4*b2
a5b3 := a5*b3
a6b3 := a6*b3
# total effect
total1 := c1 + (a1*b1) + (a3*b2) + (a5*b3)
total2 := c2 + (a2*b1) + (a4*b2) + (a6*b3)'
nickydv is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.