Cross-level mediation in lavaan

167 views
Skip to first unread message

David J.

unread,
Feb 11, 2019, 11:19:59 PM2/11/19
to lavaan
Can lavaan handle cross-level mediation for multilevel data? I have several models I would like to run that are somewhat like Kris Preacher's Mplus models (syntax here: http://quantpsy.org/pubs/syntax_appendix_081311.pdf).

Thanks. 

Terrence Jorgensen

unread,
Feb 19, 2019, 3:01:59 PM2/19/19
to lavaan
Can lavaan handle cross-level mediation for multilevel data? 

Yes.

Galo <- read.table("http://users.ugent.be/~yrosseel/lavaan/tubingen2017/Galo.dat")
names
(Galo) <- c("school", "sex", "galo", "advice", "feduc", "meduc",
                 
"focc", "denom")
# missing data
Galo[Galo == 999] <- NA


model
<- '
level: within
  wses =~ a*focc + b*meduc + c*feduc
  advice ~ wc*wses + wb*galo
  galo   ~ wa*wses
  # residual correlation
  focc ~~ feduc
level: between
  bses =~ a*focc + b*meduc + c*feduc
  advice ~ bc*bses + bb*galo
  galo   ~ ba*bses + denom
  feduc ~~ 0*feduc
# indirect effects
  wi := wa * wb
  bi := ba * bb
'

library
(lavaan)
fit <- sem(model, data = Galo, cluster = "school", fixed.x = FALSE,
           missing
= "fiml", std.lv = TRUE, h1 = TRUE)
summary
(fit, fit.measures = TRUE, standardized = TRUE)


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