multiple mediators in lavaan?

1,061 views
Skip to first unread message

NewInMediation

unread,
Aug 11, 2017, 3:45:05 PM8/11/17
to lavaan
Hi,

Can we put multiple mediators in lavaan (instead of multiple models with only one mediator)? I heard psych package can do it, but I wonder if it's possible in lavaan as well to continue to use lavaan.

Thanks in advance,
NewInMediation

Terrence Jorgensen

unread,
Aug 12, 2017, 10:44:48 AM8/12/17
to lavaan
In principle, there is no limit to the number of mediators, nor to the functional form of the causal model (given logical idenfiability conditions).  In other words, you should be able to write the syntax that fits the model you want to fit.  

http://lavaan.ugent.be/tutorial/mediation.html

That example only uses the classic 3-variable scenario, but you could search this forum for "mediation" threads that have other examples.

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

Adam Omidpanah

unread,
Aug 14, 2017, 3:02:57 PM8/14/17
to lavaan
Is it a parallel or sequential mediation analysis?

Terrence Jorgensen

unread,
Aug 15, 2017, 7:54:17 AM8/15/17
to lavaan
Is it a parallel or sequential mediation analysis?

Not having seen your model, I would not know.  But these are not lavaan issues.  You can post general SEM questions on SEMNET:

Message has been deleted

NewInMediation

unread,
Aug 30, 2017, 11:50:30 AM8/30/17
to lavaan
Thanks everyone for your input,

But I think misunderstanding happened. My question was lavaan specific, not SEM general: how we can put multiple mediators in lavaan. 

Here is my model:

p16a18c24 <- ' # direct effect
myOutcome ~ c*myPredictor
# mediator
myMediator ~ a*myPredictor
myOutcome ~ b*myMediator
# indirect effect (a*b)
ab := a*b
# total effect
total := c + (a*b)
'
fit.p16a18c24 <- sem(p16a18c24,data=m,missing="fiml",se="bootstrap")
summary(fit.p16a18c24,fit.measures=TRUE,standardized=TRUE,rsquare=TRUE)

Am I supposed to add mediators like this?

p16a18c24 <- ' # direct effect
myOutcome ~ c*myPredictor
# mediator
myMediator1 ~ a1*myPredictor
myOutcome ~ b1*myMediator1
myMediator2 ~ a2*myPredictor
myOutcome ~ b2*myMediator2
myMediator3 ~ a3*myPredictor
myOutcome ~ b3*myMediator3
# indirect effect (a*b)
a1b1 := a1*b1
a2b2 := a2*b2
a3b3 := a3*b3
# total effect
total := c + (a1*b1+a2*b2+a3*b3)
'
fit.p16a18c24 <- sem(p16a18c24,data=m,missing="fiml",se="bootstrap")
summary(fit.p16a18c24,fit.measures=TRUE,standardized=TRUE,rsquare=TRUE)

Or is there another way?

I would really appreciate your clarification.

NewInMediation

NewInMediation

unread,
Aug 30, 2017, 3:04:10 PM8/30/17
to lavaan
Thanks Yves, I really appreciate your reply.

But I don't understand what you meant by "use different labels, for different paths." Did you mean a1, a2, and a3 or names of variables (myMediator1, 2, & 3)? 

Thank you so much,
NewInMediation


On Wed, Aug 30, 2017 at 11:44 AM, Yves Rosseel wrote:
Am I supposed to add mediators like this?

p16a18c24 <- ' # direct effect
myOutcome ~ c*myPredictor
# mediator
myMediator1 ~ a*myPredictor
myOutcome ~ b*myMediator1
myMediator2 ~ a*myPredictor
myOutcome ~ b*myMediator2
myMediator3 ~ a*myPredictor
myOutcome ~ b*myMediator3

# indirect effect (a*b)
ab := a*b
# total effect
total := c + (a*b)
'

yes, BUT you may want to use different labels, for different paths:


p16a18c24 <- ' # direct effect
myOutcome ~ c*myPredictor
# mediator
myMediator1 ~ a1*myPredictor
myOutcome ~ b1*myMediator1
myMediator2 ~ a2*myPredictor
myOutcome ~ b2*myMediator2
myMediator3 ~ a3*myPredictor
myOutcome ~ b3*myMediator3
# indirect effects (a*b)
ab1 := a1*b1
ab2 := a2*b2
ab3 := a3*b3
# total effect
total := c + (a1*b1) + (a2*b2) + (a3*b3)
'

Yves.

Reply all
Reply to author
Forward
0 new messages