Help the Stat Consulting Group by giving a gift

How can I analyze multiple mediators in Stata?

comparing indirect effects in multiple mediator models.

Mediator variables are variables that sit between independent variable and dependent variable and mediate the effect of the IV on the DV. A model with two mediators is shown in the figure below.

sureg (mv1 iv)(mv2 iv)(dv mv1 mv2 mv3 iv)

Now we have all the coefficients we need to compute the indirect effect coefficients and their standard errors. We can do this using theuse http://www.ats.ucla.edu/stat/data/hsb2, clear sureg (read math)(write math)(science read write math)Seemingly unrelated regression ---------------------------------------------------------------------- Equation Obs Parms RMSE "R-sq" chi2 P ---------------------------------------------------------------------- read 200 1 7.662848 0.4386 156.26 0.0000 write 200 1 7.437294 0.3812 123.23 0.0000 science 200 3 6.983853 0.4999 199.96 0.0000 ---------------------------------------------------------------------- ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- read | math | .724807 .0579824 12.50 0.000 .6111636 .8384504 _cons | 14.07254 3.100201 4.54 0.000 7.996255 20.14882 -------------+---------------------------------------------------------------- write | math | .6247082 .0562757 11.10 0.000 .5144099 .7350065 _cons | 19.88724 3.008947 6.61 0.000 13.98981 25.78467 -------------+---------------------------------------------------------------- science | read | .3015317 .0679912 4.43 0.000 .1682715 .434792 write | .2065257 .0700532 2.95 0.003 .0692239 .3438274 math | .3190094 .0759047 4.20 0.000 .170239 .4677798 _cons | 8.407353 3.160709 2.66 0.008 2.212476 14.60223 ------------------------------------------------------------------------------

The results above suggest that each of the separate indirect effects as well as the total indirect effect are significant. From the above results it is also possible to compute the ratio of indirect to direct effect and the proportion due to the indirect effect. These computations require an estimate of the direct effect, which can be found in the/* indirect via read */ nlcom [read]_b[math]*[science]_b[read]_nl_1: [read]_b[math]*[science]_b[read] ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _nl_1 | .2185523 .05229 4.18 0.000 .1160659 .3210388 ------------------------------------------------------------------------------/* indirect via write */ nlcom [write]_b[math]*[science]_b[write]_nl_1: [write]_b[math]*[science]_b[write] ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _nl_1 | .1290183 .0452798 2.85 0.004 .0402715 .2177651 ------------------------------------------------------------------------------/* total indirect */ nlcom [read]_b[math]*[science]_b[read]+[write]_b[math]*[science]_b[write]_nl_1: [read]_b[math]*[science]_b[read]+[write]_b[math]*[science]_b[write] ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _nl_1 | .3475706 .0594916 5.84 0.000 .2309693 .4641719 ------------------------------------------------------------------------------

/* ratio of indirect to direct */ display .3475706/.31900941.0895309/* proportion of total effect that is mediated */ display .3475706/(.3475706+.3190094).52142369

We could use the bootstrap standard errors to see if the indirect effects are significant but it is usually recommended that bias-corrected or percentile confidence intervals be used instead. These confidence intervals are nonsymmetric reflecting the skewness of the sampling distribution of the product coefficients. If the confidence interval does not contain zero than the indirect effect is considered to be statistically significant.capture program drop bootmm program bootmm, rclass syntax [if] [in] sureg (read math)(write math)(science read write math) `if' `in' return scalar indread = [read]_b[math]*[science]_b[read] return scalar indwrite = [write]_b[math]*[science]_b[write] return scalar indtotal = [read]_b[math]*[science]_b[read]+ /// [write]_b[math]*[science]_b[write] end bootstrap r(indread) r(indwrite) r(indtotal), bca reps(5000) nodots: bootmmBootstrap results Number of obs = 200 Replications = 5000 command: bootmm _bs_1: r(indread) _bs_2: r(indwrite) _bs_3: r(indtotal) ------------------------------------------------------------------------------ | Observed Bootstrap Normal-based | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _bs_1 | .2185523 .0544617 4.01 0.000 .1118094 .3252953 _bs_2 | .1290183 .0498037 2.59 0.010 .0314048 .2266318 _bs_3 | .3475706 .0653076 5.32 0.000 .2195701 .4755711 ------------------------------------------------------------------------------

In this example, the total indirect effect ofestat boot, percentile bc bcaBootstrap results Number of obs = 200 Replications = 5000 command: bootmm _bs_1: r(indread) _bs_2: r(indwrite) _bs_3: r(indtotal) ------------------------------------------------------------------------------ | Observed Bootstrap | Coef. Bias Std. Err. [95% Conf. Interval] -------------+---------------------------------------------------------------- _bs_1 | .21855231 -.0009252 .05446169 .1116576 .3263005 (P) | .1140179 .3286456 (BC) | .1140179 .3286456 (BCa) _bs_2 | .12901828 .0009822 .04980373 .0375536 .2286579 (P) | .0375377 .22842 (BC) | .0333511 .2264691 (BCa) _bs_3 | .34757059 .000057 .0653076 .2181866 .4773324 (P) | .2209776 .4805473 (BC) | .2158857 .4752103 (BCa) ------------------------------------------------------------------------------ (P) percentile confidence interval (BC) bias-corrected confidence interval (BCa) bias-corrected and accelerated confidence interval

Although the total and individual indirect are much smaller in the model with the covariate, they are still statistically significant using the 95% confidence intervals.capture program drop bootmm program bootmm, rclass syntax [if] [in] sureg (read math socst)(write math socst)(science read write math socst) `if' `in' return scalar indread = [read]_b[math]*[science]_b[read] return scalar indwrite = [write]_b[math]*[science]_b[write] return scalar indtotal = [read]_b[math]*[science]_b[read] + /// [write]_b[math]*[science]_b[write] end bootstrap r(indread) r(indwrite) r(indtotal), bca reps(5000) nodots: bootmmBootstrap results Number of obs = 200 Replications = 5000 command: bootmm _bs_1: r(indread) _bs_2: r(indwrite) _bs_3: r(indtotal) ------------------------------------------------------------------------------ | Observed Bootstrap Normal-based | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _bs_1 | .1561855 .040306 3.87 0.000 .0771872 .2351837 _bs_2 | .0890589 .0352121 2.53 0.011 .0200444 .1580733 _bs_3 | .2452443 .0477817 5.13 0.000 .1515939 .3388947 ------------------------------------------------------------------------------estat boot, percentile bc bcaBootstrap results Number of obs = 200 Replications = 5000 command: bootmm _bs_1: r(indread) _bs_2: r(indwrite) _bs_3: r(indtotal) ------------------------------------------------------------------------------ | Observed Bootstrap | Coef. Bias Std. Err. [95% Conf. Interval] -------------+---------------------------------------------------------------- _bs_1 | .15618546 -.0016606 .04030598 .0784972 .2359464 (P) | .0836141 .2407494 (BC) | .0838816 .2413034 (BCa) _bs_2 | .08905886 .0000963 .0352121 .0241053 .163005 (P) | .0274379 .1664222 (BC) | .0260387 .164438 (BCa) _bs_3 | .24524432 -.0015643 .0477817 .1536668 .341307 (P) | .1581453 .3477974 (BC) | .1581453 .3477974 (BCa) ------------------------------------------------------------------------------ (P) percentile confidence interval (BC) bias-corrected confidence interval (BCa) bias-corrected and accelerated confidence interval