7
$\begingroup$

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.

$\endgroup$

1 Answer 1

7
$\begingroup$

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.

$\endgroup$
4
  • 2
    $\begingroup$ Is it a mistake that the equations for Y and M include the interaction without also including the main effect of the moderator (W)? $\endgroup$ Commented Jul 7, 2017 at 9:37
  • 2
    $\begingroup$ Here is a helpful comparison of moderated mediation output from Haye's PROCESS macro for SPSS and lavaan (scroll down for model 7): nickmichalak.blogspot.com/2016/07/… It looks like it does indeed need both main effects (X and W) in addition to their interaction. $\endgroup$ Commented Jul 7, 2017 at 10:02
  • 2
    $\begingroup$ Shouldn't the answer be edited to reflect @RoseHartman's comment ? $\endgroup$
    – streamline
    Commented Feb 1, 2019 at 15:45
  • $\begingroup$ Yes, it should have. Sorry I only just now saw this, but I edited the post to include the simple effect of W (and link to the old thread), so the XW term is now actually the interaction, rather than merely a nested effect. $\endgroup$
    – Terrence
    Commented May 30 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.