I posted this question in another location (the lavaan forum) and was provided the answer by Terrence Jorgensen. Question and answer:
I would like to calculate the conditional indirect effects of X
on Y
given a set of values for the moderator W
. Both X
and the moderator are continuous. Could you provide some direction for structuring the model syntax?
Assuming X
and W
are both observed variables, you can calculate the product term XW
in your data.frame and simply add the product term (X-W
interaction) to the models for M
and Y
in Yves' example earlier in this thread (but a single-group version, since your moderator is continuous).
model <- '
Y ~ c*X + W + cw*XW + b*M
M ~ a*X + W + aw*XW
## indirect and total effects, conditional on W == 0
ab0 := a*b # + 0*aw*b
total0 := ab0 + c # + 0*cw
## indirect and total effects, conditional on W == 1
ab1 := ab0 + 1*aw*b
total1 := ab1 + c + 1*cw
## indirect and total effects, conditional on W == 2
ab2 := ab0 + 2*aw*b
total2 := ab2 + c + 2*cw
'
This is specifically designed to assess conditional indirect effects using the lavaan
package.