Monte Carlo Method for

Assessing Mediation

Assessing Mediation

An interactive tool for creating confidence intervals for indirect effects

© 2010-2017,

Kristopher J. Preacher

Kristopher J. Preacher

Monte Carlo method for assessing mediation: An interactive tool for creating confidence intervals for indirect effects

James P. Selig (*University of Arkansas for Medical Sciences*)

Kristopher J. Preacher (*Vanderbilt University*)

This web utility may be cited in APA style in the following manner:

Selig, J. P., & Preacher, K. J. (2008, June). Monte Carlo method for assessing mediation: An interactive tool for creating confidence intervals for indirect effects [Computer software]. Available from http://quantpsy.org/.

If the Rweb server is not working

The code generated by this utility can be pasted directly into an R console window. R (a free, open-source statistical computing environment) may be obtained here: http://cran.r-project.org/.

A variable is a __mediator__ if it carries the influence of an independent variable (IV) to a dependent variable (DV). Thus the IV has an indirect effect on the DV that is transmitted through the mediator.

The Monte Carlo Method for Assessing Mediation (MCMAM) was first described and evaluated by MacKinnon, Lockwood, & Williams (2004), but has much in common with the parametric bootstrap described by Efron & Tibshirani (1986). Bauer, Preacher, & Gil (2006) used this method in examining mediation in multilevel models, and the statistical software package AMOS 16.0 is cabable of implementing a similar Monte Carlo procedure for any model when provided estimates and standard errors. The method relies on the assumption that the *a* and *b* parameters (see figure below) have normal sampling distributions. Using the parameter estimates and their associated asymptotic variances and covariance, random draws from the joint distribution of *a* and *b* are simulated and the product of these values is computed. This procedure is repeated a very large number of times and the resulting distributon of the *a***b* values is used to estimate a confidence interval around the observed value of *a***b*. In the MacKinnon, Lockwood, & Williams (2004) simulation, the MCMAM did not perform as well as the bias-corrected bootstrap, but did perform better than the widely used Sobel test (Sobel, 1982). We think the MCMAM is noteworthy due to its reasonably good performance coupled with the fact that it can be implemented without the need for the original data.

The version of the code here differs from that in Preacher & Selig (2012) by the incorporation of the asymptotic covariance matrix of the estimates of *a* and *b* rather than the standard errors of *a* and *b*. This matrix is obtained in different ways depending on what software is used to obtain the estimates.

The MCMAM will be most useful when the data are unavailable. When the data are available, we recommend the use of the bias-corrected bootstrap procedure. See Preacher & Hayes (2004) for macros to bootstrap mediation effects. However, the MCMAM procedure allows for the assessment of mediation effects without raw data and even when the original study did not examine mediation. We believe that this procedure has the potential to be especially useful for those seeking to summarize literature on indirect effects.

The user may elect to use this procedure to test a null hypothesis about the population mediation effect. If the null hypothesized value of *a***b* (usually 0) falls outside the interval, the null hypothesis of no mediation is rejected. Alternatively, a null distribution of *a***b* can be generated by setting either *a* or *b* (or both) to 0, in which case the null hypothesis is rejected if the observed *a***b* falls outside the interval.

*a*, *b*, and *c'* are path coefficients. Values in parentheses are standard errors of those path coefficients.

*a* = raw (unstandardized) regression coefficient for the association between IV and mediator.

var(*a*) = asymptotic sampling variance of *a*.

*b* = raw coefficient for the association between the mediator and the DV (when the IV is also a predictor of the DV).

var(*b*) = asymptotic sampling variance of *b*.

- Run a regression analysis (or path analysis, SEM, etc.) with the IV predicting the mediator.
This will give
*a*. - Run a regression analysis with the IV and mediator predicting the DV.
This will give
*b*. - If you use SEM, path analysis, multilevel modeling, or some other multivariate method to obtain both
*a*and*b*from a single model, then var(*a*), var(*b*), and cov(*a*,*b*) can be found in the asymptotic covariance matrix of the parameter estimates. If you use regression to obtain*a*and*b*in separate steps, then var(*a*) and var(*b*) are simply the squared standard errors, and cov(*a*,*b*) = 0.

- Retrieve values reported from sequential regression models as described above, OR
- Retrieve values from a single model containing all necessary parameters, OR
- Use a covariance matrix to run regression analyses as described above, using the covariance matrix as the data.

Enter the required values into the cells below as well as the desired level of confidence (from 1% to 99%) and the number of repetitions for the simulation (minimum is 1000, but many thousands are recommended). The program will generate R code that can be submitted to Rweb to estimate a confidence interval for the indirect effect. You may also request that the simulated values of the indirect effect used to generate the histogram and confidence interval be provided, but in this case the code should be run with R rather than submitted to Rweb (Rweb servers do not usually permit use of the "write" function). Note that if this option is selected, the histogram will appear after the column of values. The code is editable should you wish to make changes to the simulation or the output. For example, you could change the number of repetitions, the number of columns in the histogram showing the distribution of the indirect effect, or the title of the histogram.

Bauer, D. J., Preacher, K. J., & Gil, K. M. (2006). Conceptualizing and testing random indirect effects and moderated mediation in multilevel models: New procedures and recommendations. *Psychological Methods*, *11*, 142-163.

Efron, B., & Tibshirani, R. (1986). Bootstrap methods for standard errors, confidence intervals, and other measures of statistical accuracy (with discussion). *Statistical Science*, *1*, 54-75.

MacKinnon, D. P., Lockwood, C. M., & Williams, J. (2004). Confidence limits for the indirect effect: Distribution of the product and resampling methods. *Multivariate Behavioral Research*, *39*, 99-128.

Preacher, K. J., & Hayes, A. F. (2004). SPSS and SAS procedures for estimating indirect effects in simple mediation models. *Behavior Research Methods, Instruments, & Computers*, *36*(4), 717-731.

Preacher, K. J., & Selig, J. P. (2012). Advantages of Monte Carlo confidence intervals for indirect effects. *Communication Methods and Measures*, *6*, 77-98.

R Development Core Team (2005). *R: A language and environment for statistical computing*. R Foundation for Statistical Computing, Vienna, Austria. ISBN 3-900051-07-0, URL: http://www.R-project.org.

Sobel, M. E. (1982). Asymptotic intervals for indirect effects in structural equations models. In S. Leinhart (Ed.), *Sociological methodology 1982* (pp.290-312). San Francisco: Jossey-Bass.

Original version posted June, 2008. Our thanks to Zhen Zhang for several suggested improvements in January, 2015.