# Calculating SE for a path in Moderated Mediation

I am trying to hand calculate the standard error for the a path in a moderated mediation model where the moderator modifies the a path. For example:

Mediator = X + Moderator + X*M

I gather that the a path would be calculated like so (with coefficients from the above model):

X + (X*M * Moderator)

How would I calculate the standard error in this case? I am not having any luck finding the answer so far.

Update

In response to the request for more information, I am updating the question.

Say I think that the coping mediates the relationship between gender and depression but that this mediation effect depends on age. I run 2 regressions:

Outcome = Coping

                  Estimate Std. Error t value Pr(>|t|)
(Intercept)       4.2063     0.1529  27.513  < 2e-16 ***
Age               0.6621     0.2739   2.417  0.01714 *
Gender            0.6853     0.2189   3.131  0.00218 **
Age*Gender       -0.8737     0.3726  -2.345  0.02065 *


Outcome = Depression, with Coping

                  Estimate Std. Error t value Pr(>|t|)
(Intercept)      5.19472    0.31975  16.246  < 2e-16 ***
Coping          -0.59130    0.07054  -8.382  1.1e-13 ***
Age             -0.37615    0.21850  -1.721 0.087717 .
Gender          -0.66654    0.17728  -3.760 0.000263 ***
Age*Gender       0.20956    0.29682   0.706 0.481535


I believe that I would need to calculate the indirect and total effects (conditional on Age = 45) with the following:

indirect = 0.6853*-0.59130 + 45*-0.8737*-0.59130
total = indirect + -0.66654 + 45*0.20956


How would I calculate the SE for the (a) path to Coping through Age*Gender and/or how would I calculate the SE for these conditional indirect and total effects?

• This is unclear. There isn't enough information here for this to be answerable. – gung May 23 '17 at 16:23

## 1 Answer

You do not calculate a standard error in this case. When you multiply coefficients together (i.e., an indirect effect), the product is not normally distributed. What we generally do instead is get a bootstrapped 95% confidence interval around the product.

I have R code, sample R data, and a .pdf guide here that implements moderation, mediation, and moderated mediation. This code implements the equations discussed in Hayes's (2015) paper proposing the index of moderated mediation.

• That is essentially what I need---some way of testing the conditional indirect effect. I have used Hayes' macros before, and it is great that you have adapted them for R. However, I am running robust regressions (lmrob). I have not found any packages for moderated mediation that work with lmrob objects. Any ideas? – user162454 May 23 '17 at 21:05
• This will be computationally intensive, but you could do the bootstrapping manually. You basically sample a random list of rows n from your data set (with replacement), do the analyses, extract the index of moderated mediation and/or indirect effects, and save them into an object. Do this, say, 5000 times in a for loop. Then get the mean and 1.96*SD of your indirect effects. And you have a bootstrap confidence interval. I have done this before, but don't have the code on me currently. – Mark White May 23 '17 at 21:17
• @user162454 actually, there is a much easier way than I just said above! The code I linked to uses the lavaan package. The lavaan package has options for various robust standard errors: first order derivatives, Huber-White, Satorra-Bentler, etc. You can simply add to the code in the sem() function a specific se or estimator argument. Search this documentation for "robust": cran.r-project.org/web/packages/lavaan/lavaan.pdf – Mark White May 24 '17 at 0:23