Hi lavaan developer and community,
I am not sure if control variables need to be listed only to the line for a mediator or to the outcome (direct effect) as well. I don't see this information after searching for it here and Googling for hours. I would really appreciate your clarification on if this syntax is correct for adding two control variables for a mediation.
X: predictor
M: mediator
Y: outcome
CV1: control variable 1
CV2: control variable 2
1) adding controls to only the mediator
# direct effect
Y ~ c*X
# mediator
M ~ a*X + c1*CV1 + c2*CV2
Y ~ b*M
# indirect effect (a*b)
ab := a*b # do I need to define any indirect effect from the controls?
# total effect
total := c + (a*b)
2) adding controls to the mediator and the direct effect
# direct effect
Y ~ c*X + c1*CV1 + c2*CV2
# mediator
M ~ a*X + c1*CV1 + c2*CV2
Y ~ b*M
# indirect effect (a*b)
ab := a*b
ac1 := a*c1 # Do I need to define indirect effect terms by controls and b as well?
ac2 := a*c2
# total effect
total := c + (a*b) + ac1 + ac2 # Do I need to define total effect terms with controls and b as well?
Thanks in advance,
Avid lavaan user