Sample Size Calculation and Power Analysis for the General Mediation Analysis Method
Abstract
1. Introduction
2. Methodology
2.1. Overview of the General Mediation Analysis Method
2.2. Power Analysis in General Mediation Analysis
2.2.1. Critical Values
- No association between the exposure and mediator; i.e., a = 0.
- No association between the mediator and the outcome; i.e., b = 0.
- No association between either the mediator and the exposure or with the outcome; i.e., a = 0 and b = 0.
2.2.2. The Algorithm to Find Critical Values
- For the ith scenario under the null hypothesis as listed above, , adjust to .
- (1)
- Using the parameter setting, , generates datasets where (see Remark 2).
- (2)
- For each simulated dataset use the function in the mma package [7] to obtain bootstrap estimates of indirect effects of the mediator, denoted as , where .
- (3)
- Step (b) produces estimates for the kth parameter configuration, . Aggregate to form a sample from the distribution of the indirect effect estimates under the null hypothesis ith scenario, ∼. Extract the percentile from the , denoted as , , and for the alternative hypothesis , or ≠ 0 respectively.
- (4)
- To control for the type I error, and are the lower and upper critical values for one-sided tests with an alternative hypothesis and respectively with the parameter configuration Similarly, for two-sided tests, and are the lower and upper critical values for the alternative hypothesis ≠ 0.
- Fit four separate smoothing spline functions with restrictions (see Remark 4), denoted as , , and . The outcomes for these models are the lower and upper critical values , for one-sided tests and , for two-sided tests, respectively, while is the vector of predictors (see Remark 4).
2.2.3. Power Estimation
2.2.4. The Algorithm for Power Calculation
- Generate datasets for using user-specified parameters, .
- (a)
- For each dataset , fit the mediation model using the function and obtain B bootstrap estimates of the indirect effect of M, denoted as for
- (b)
- Combine all simulated estimates to form the distribution of the estimated indirect effects under the alternative hypothesis, ∼.
- Generate the lower and upper critical values from the fitted smoothing spline functions for the chosen alternative hypothesis.
- Calculate statistical power as the probability that the distribution of the indirect effect of M under falls in the rejection region.
3. Simulation Studies
3.1. Power Analysis
3.2. Sample Size Calculation
4. Discussion
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Baron, R.M.; Kenny, D.A. The moderator-mediator variable distinction in social psychological research: Conceptual, strategic, and statistical considerations. J. Pers. Soc. Psychol. 1986, 51, 1173–1182. [Google Scholar] [CrossRef] [PubMed]
- Gunzler, D.; Chen, T.; Wu, P.; Zhang, H. Introduction to mediation analysis with structural equation modeling. Shanghai Arch. Psychiatry 2013, 25, 390–394. [Google Scholar] [PubMed]
- Hayes, A.F. Introduction to Mediation, Moderation, and Conditional Process Analysis: A Regression-Based Approach; Guilford Publications: New York, NY, USA, 2017. [Google Scholar]
- MacKinnon, D. Introduction to Statistical Mediation Analysis; Routledge: Oxfordshire, UK, 2012. [Google Scholar]
- Preacher, K.J. Advances in mediation analysis: A survey and synthesis of new developments. Annu. Rev. Psychol. 2015, 66, 825–852. [Google Scholar] [CrossRef] [PubMed]
- Rucker, D.D.; Preacher, K.J.; Tormala, Z.L.; Petty, R.E. Mediation analysis in social psychology: Current practices and new recommendations. Soc. Personal. Psychol. Compass 2011, 5, 359–371. [Google Scholar] [CrossRef]
- Yu, Q.; Li, B. mma: An R Package for Mediation Analysis with Multiple Mediators. J. Open Res. Softw. 2017, 5, 11. [Google Scholar] [CrossRef]
- MacKinnon, D.P.; Lockwood, C.M.; Hoffman, J.M.; West, S.G.; Sheets, V. A comparison of methods to test the significance of the mediated effect. Psychol. Methods 2002, 7, 83–104. [Google Scholar] [CrossRef]
- Hayes, A.F. Beyond Baron and Kenny: Statistical mediation analysis in the new millennium. Commun. Monogr. 2009, 76, 408–420. [Google Scholar] [CrossRef]
- Fritz, M.S.; MacKinnon, D.P. Required Sample Size to Detect the Mediated Effect. Psychol. Sci. 2007, 18, 233–239. [Google Scholar] [CrossRef]
- Muthén, L.K.; Muthén, B.O. How to use a Monte Carlo study to decide on sample size and determine power. Struct. Equ. Model. 2002, 9, 599–620. [Google Scholar] [CrossRef]
- Thoemmes, F.; MacKinnon, D.P.; Reiser, M.R. Power analysis for complex mediational designs using Monte Carlo methods. Struct. Equ. Model. 2010, 17, 510–534. [Google Scholar] [CrossRef]
- Qin, X. Sample size and power calculations for causal mediation analysis: A Tutorial and Shiny App. Behav. Res. Methods 2024, 56, 1738–1769. [Google Scholar] [CrossRef]
- Schoemann, A.M.; Boulton, A.J.; Short, S.D. Determining Power and Sample Size for Simple and Complex Mediation Models. Soc. Psychol. Personal. Sci. 2017, 8, 379–386. [Google Scholar] [CrossRef]
- Zhang, Z. Monte Carlo based statistical power analysis for mediation models: Methods and software. Behav. Res. Methods 2014, 46, 1184–1198. [Google Scholar] [CrossRef] [PubMed]
- Miočević, M.; MacKinnon, D.P.; Levy, R. Power in Bayesian Mediation Analysis for Small Sample Research. Struct. Equ. Model. Multidiscip. J. 2017, 24, 666–683. [Google Scholar] [CrossRef] [PubMed]
- Pan, H.; Liu, S.; Miao, D.; Yuan, Y. Sample size determination for mediation analysis of longitudinal data. BMC Med. Res. Methodol. 2018, 18, 32. [Google Scholar] [CrossRef] [PubMed]
- Sim, M.; Kim, S.-Y.; Suh, Y. Sample Size Requirements for Simple and Complex Mediation Models. Educ. Psychol. Meas. 2022, 82, 76–106. [Google Scholar] [CrossRef]
- Sobel, M.E. Asymptotic confidence intervals for indirect effects in structural equation models. Sociol. Methodol. 1982, 13, 290–312. [Google Scholar] [CrossRef]
- Bollen, K.A.; Stine, R. Direct and indirect effects: Classical and bootstrap estimates of variability. Sociol. Methodol. 1990, 20, 115–140. [Google Scholar] [CrossRef]
- Yu, Q.; Li, B. mma: Multiple Mediation Analysis. 2023. Available online: https://cran.r-project.org/web/packages/mma/mma.pdf (accessed on 5 January 2025).
- Pya, N.; Wood, S.N. Shape constrained additive models. Stat. Comput. 2015, 25, 543–559. [Google Scholar] [CrossRef]
- Morgan, P.J.; Lubans, D.R.; Collins, C.E.; Warren, J.M.; Callister, R. Exploring the mechanisms of weight loss in the SHED-IT intervention for overweight men: A mediation analysis. Int. J. Behav. Nutr. Phys. Act. 2009, 6, 76. [Google Scholar] [CrossRef]
- Antoni, M.H.; Lechner, S.C.; Kazi, A.; Wimberly, S.R.; Sifre, T.; Urcuyo, K.R.; Phillips, K.; Glück, S.; Carver, C.S. How stress management improves benefit finding, quality of life, and health status in women with early-stage breast cancer. J. Consult. Clin. Psychol. 2006, 74, 1143–1152. [Google Scholar] [CrossRef]
- Preacher, K.J.; Selig, J.P. Advantages of Monte Carlo confidence intervals for indirect effects. Commun. Methods Meas. 2012, 6, 77–98. [Google Scholar] [CrossRef]


| Assumption | Description |
|---|---|
| A1: No X-Y Confounding | No unmeasured confounding of the exposure–outcome relationship. |
| A2: No X-M Confounding | No unmeasured confounding of the exposure–mediator relationship |
| A3: No M-Y Confounding | No unmeasured confounding of the mediator–outcome relationship. |
| A4: No M-M Causality | Assumes that in multi-mediator models, one mediator does not causally affect another (independent mediators). |
| Parameter | Description |
|---|---|
| a | Effect size from exposure to mediator |
| b | Effect size from mediator to outcome |
| c | Direct effect from exposure to outcome |
| x | Exposure type (continuous, binary) |
| m | Mediator type (continuous, binary) |
| y | Outcome type (continuous, binary, surv) |
| xsig | Standard deviation of the exposure variable |
| msig | Standard deviation of the mediator variable |
| ysig | Standard deviation of the outcome variable |
| Duration (optional) | Study duration for time-to-event outcome |
| Recruitment (optional) | Recruitment period for time-to-event outcome |
| n (optional) | Sample size (used to estimate power) |
| power (optional) | Desired power (used to estimate required sample size) |
| alpha (optional) | Significance level (default = 0.05) |
| test | Alternative hypothesis (less than 0, greater than 0, two-sided) |
| plot (optional) | Logical flag to generate power vs. sample size plot when both n and power are NULL |
| Sample Size (n) | Power for Small Effect (ab = 0.02) | Power for Medium Effect (ab = 0.15) | Power for Large Effect (ab = 0.35) |
|---|---|---|---|
| 25 | 0.06 | 0.24 | 0.61 |
| 50 | 0.11 | 0.62 | 0.94 |
| 75 | 0.16 | 0.86 | 0.99 |
| 100 | 0.22 | 0.96 | 0.99 |
| 200 | 0.44 | 1.00 | 0.99 |
| 350 | 0.71 | 1.00 | 0.99 |
| 500 | 0.89 | 1.00 | 0.99 |
| Sample Size (n) | Power for Small Effect (ab = 0.02) | Power for Medium Effect (ab = 0.15) | Power for Large Effect (ab = 0.35) |
|---|---|---|---|
| 25 | 0.06 | 0.24 | 0.61 |
| 50 | 0.11 | 0.62 | 0.94 |
| 75 | 0.16 | 0.86 | 0.99 |
| 100 | 0.22 | 0.96 | 0.99 |
| 200 | 0.44 | 0.99 | 0.99 |
| 350 | 0.71 | 0.99 | 0.99 |
| 500 | 0.89 | 0.99 | 0.99 |
| Sample Size (n) | Power for Small Effect (ab = 0.02) | Power for Medium Effect (ab = 0.15) | Power for Large Effect (ab = 0.35) |
|---|---|---|---|
| 25 | 0.01 | 0.05 | 0.14 |
| 50 | 0.02 | 0.12 | 0.35 |
| 75 | 0.03 | 0.20 | 0.55 |
| 100 | 0.05 | 0.29 | 0.70 |
| 200 | 0.10 | 0.60 | 0.95 |
| 350 | 0.18 | 0.85 | 0.99 |
| 500 | 0.26 | 0.95 | 0.99 |
| Sample Size (n) | Power for Small Effect (ab = 0.02) | Power for Medium Effect (ab = 0.15) | Power for Large Effect (ab = 0.35) |
|---|---|---|---|
| 25 | 0.02 | 0.09 | 0.22 |
| 50 | 0.04 | 0.20 | 0.48 |
| 75 | 0.06 | 0.35 | 0.72 |
| 100 | 0.09 | 0.48 | 0.86 |
| 200 | 0.18 | 0.76 | 0.98 |
| 350 | 0.31 | 0.94 | 0.99 |
| 500 | 0.42 | 0.99 | 0.99 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Rizvi, N.; Bam, A.; Cao, W.; Yu, Q. Sample Size Calculation and Power Analysis for the General Mediation Analysis Method. Stats 2026, 9, 19. https://doi.org/10.3390/stats9010019
Rizvi N, Bam A, Cao W, Yu Q. Sample Size Calculation and Power Analysis for the General Mediation Analysis Method. Stats. 2026; 9(1):19. https://doi.org/10.3390/stats9010019
Chicago/Turabian StyleRizvi, Nubaira, Amjila Bam, Wentao Cao, and Qingzhao Yu. 2026. "Sample Size Calculation and Power Analysis for the General Mediation Analysis Method" Stats 9, no. 1: 19. https://doi.org/10.3390/stats9010019
APA StyleRizvi, N., Bam, A., Cao, W., & Yu, Q. (2026). Sample Size Calculation and Power Analysis for the General Mediation Analysis Method. Stats, 9(1), 19. https://doi.org/10.3390/stats9010019

