7

I am interested in determining the conditional indirect effects of X on Y at a series of values for a third variable Z.

I was able to use the lavaan package to calculate some initial indirect effects based of the syntax available in this post: Multiple mediation analysis in R

However, I do not know how to access an output of values for conditional indirect effects once I add the interaction term into the equation.

Any support or suggestions for other packages to use would be greatly appreciated.

L. Bakker
  • 49
  • 1
  • 9
B Victor
  • 133
  • 1
  • 2
  • 8

1 Answers1

6

I posted this question in another location and was provided the answer by Terry Jorgenson. 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 + cw*XW + b*M
  M ~ a*X + 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.

L. Bakker
  • 49
  • 1
  • 9
B Victor
  • 133
  • 1
  • 2
  • 8
  • 1
    Is it a mistake that the equations for Y and M include the interaction without also including the main effect of the moderator (W)? – Rose Hartman Jul 07 '17 at 09:37
  • 2
    Here is a helpful comparison of moderated mediation output from Haye's PROCESS macro for SPSS and lavaan (scroll down for model 7): https://nickmichalak.blogspot.com/2016/07/reproducing-hayess-process-models.html It looks like it does indeed need both main effects (X and W) in addition to their interaction. – Rose Hartman Jul 07 '17 at 10:02
  • Shouldn't the answer be edited to reflect @RoseHartman's comment ? – streamline Feb 01 '19 at 15:45