Prevention Science

, Volume 16, Issue 8, pp 1128–1135 | Cite as

Sample Size for Joint Testing of Indirect Effects

  • Eric VittinghoffEmail author
  • Torsten B. Neilands


This paper presents methods to calculate sample size for evaluating mediation by joint testing of both links in an indirect pathway from exposure to mediator to outcome. Calculations rely on simulations of the underlying data structure, with testing of the two links performed under the simplifying assumption that the two test statistics are asymptotically independent. Simulations show that the proposed methods are accurate. Continuous and binary exposures and mediators, as well as continuous, binary, count, and survival outcomes are accommodated, along with over-dispersion of count outcomes, design effects, and confounding of the exposure-mediator and mediator-outcome relationships. An illustrative example is provided, and a documented R program implementing the calculations is available online.


Mediation Indirect pathway Sample size Power Generalized linear models. 



The work of Torsten B. Neilands on this research was supported by National Institutes of Health Grant P30 MH062246. The authors thank Charles E. McCulloch and Steven Gregorich for helpful discussions.

Conflict of interests

The authors declare that they have no conflict of interest.

Supplementary material

11121_2014_528_MOESM1_ESM.pdf (66 kb)
(PDF 65.9 KB)
11121_2014_528_MOESM2_ESM.txt (32 kb)
(TXT 31.9 KB)
11121_2014_528_MOESM3_ESM.pdf (184 kb)
(PDF 183 KB)


  1. Baron, R., & Kenny, D. (1986). The moderator-mediator variable distinction in social psychological research: Conceptual, strategic, and statistical considerations. Journal of Personality and Social Psychology, 51, 1173–1182.CrossRefPubMedGoogle Scholar
  2. Bernardo, M., Lipsitz, S., Harrington, D., Catalano, P. (2000). Sample size calculations for failure time random variables in non-randomized studies. Journal of the Royal Statistical Society (Series D): The Statistician, 49, 31–40.CrossRefGoogle Scholar
  3. Breen, R., Karlson, K., Holm, A. (2013). Total, direct, and indirect effects in logit and probit models. Sociological Methods & Research, 42, 164–191.CrossRefGoogle Scholar
  4. Carrico, A., Woods, W., Siever, M., Discepola, M., Dilworth, S., Neilands, T., Miller, N., Moskowitz, J. (2013). Positive affect and processes of recovery among treatment-seeking methamphetamine users. Drug and Alcohol Dependence, 132, 624–629.PubMedCentralCrossRefPubMedGoogle Scholar
  5. Cole, S., & Hernán, M. (2002). Fallibility in estimating direct effects. International Journal of Epidemiology, 31, 163–165.CrossRefPubMedGoogle Scholar
  6. Demidenko, E. (2007). Sample size determination for logistic regression revisited. Statistics in Medicine, 26, 3385–3397.CrossRefPubMedGoogle Scholar
  7. Freedman, L., & Schatzkin, A. (1992). Sample size for studying intermediate endpoints within intervention trials or observational studies. American Journal of Epidemiology, 136, 1148–1159.PubMedGoogle Scholar
  8. Fritz, M., & MacKinnon, D. (2007). Required sample size to detect the mediated effect. Psychological Science, 18, 233–239.PubMedCentralCrossRefPubMedGoogle Scholar
  9. Fritz, M., Taylor, A., MacKinnon, D. (2012). Explanation of two anomalous results in statistical mediation research. Multivariate Behavioral Research, 47, 61–87.PubMedCentralCrossRefPubMedGoogle Scholar
  10. Glueck, D., & Muller, K. (2003). Adjusting power for a baseline covariate in linear models. Statistics in Medicine, 22, 2535–2551.PubMedCentralCrossRefPubMedGoogle Scholar
  11. Hauck, W., & Donner, A. (1977). Wald’s test as applied to hypotheses in logit analyses. Journal of the American Statistical Association, 72, 851–853.Google Scholar
  12. Hicks, R., & Tingley, D. (2011). Causal mediation analysis. The Stata Journal, 11, 605–619.Google Scholar
  13. Hsieh, F., Bloch, D., Larsen, M. (1998). A simple method of sample size calculation for linear and logistic regression. Statistics in Medicine, 17, 1623–1634.CrossRefPubMedGoogle Scholar
  14. Hsieh, F., & Lavori, P. (2000). Sample-size calculations for the Cox proportional hazards regression model with nonbinary covariates. Controlled Clinical Trials, 21, 552–560.CrossRefPubMedGoogle Scholar
  15. Imai, K., Keele, L., Yamamoto, T. (2010). Identification inference, and sensitivity analysis for causal mediation effects. Statistical Science, 25, 51–71.CrossRefGoogle Scholar
  16. Judd, C., & Kenny, D. (1981). Process analysis: Estimating mediation in treatment evaluations. Evaluation Review, 5, 602–619.CrossRefGoogle Scholar
  17. Kalbfleisch, J., & Prentice, R. (1980). The Statistical Analysis of Failure Time Data. New York: Wiley.Google Scholar
  18. Kenny, D. (2013). PowMedR. R program to compute power of joint test for continuous exposure, mediator, and outcome. Available at
  19. Kohler, U., Karlson, K., Holm, A. (2011). Comparing coefficients of nested nonlinear probability models. The Stata Journal, 11, 420–438.Google Scholar
  20. Lyles, R., Lin, H.-M., Williamson, J. (2007). A practical approach to computing power for generalized linear models with nominal, count, or ordinal responses. Statistics in Medicine, 26, 1632–1648.CrossRefPubMedGoogle Scholar
  21. MacKinnon, D., Lockwood, C., Brown, C., Wang, W., Hoffman, J. (2007). The intermediate endpoint effect in logistic and probit regression. Clinical Trials, 4, 499–513.PubMedCentralCrossRefPubMedGoogle Scholar
  22. MacKinnon, D., Lockwood, C., Hoffman, J., West, S., Sheets, V. (2002). A comparison of methods to test mediation and other intervening variable effects. Psychological Methods, 7, 83–104.PubMedCentralCrossRefPubMedGoogle Scholar
  23. Mallinckrodt, B., Abraham, W., Wei, M., Russell, D. (2006). Advances in testing the statistical significance of mediation effects. Journal of Counseling Psychology, 53, 372–378.CrossRefGoogle Scholar
  24. Muthén, B. (2011). Applications of causally defined direct and indirect effects in mediation analysis using SEM in Mplus. Available at
  25. Pearl, J. (1998). Graphs, causality, and structural equation models. Sociological Methods and Research, 27, 226–284.CrossRefGoogle Scholar
  26. Pearl, J. (2001). Direct and indirect effects. In: Proceedings of the Seventeenth Conference on Uncertainty and Artificial Intelligence. CA, San Francisco.Google Scholar
  27. Pearl, J. (2011). The mediation formula: A guide to the assessment of causal pathways in nonlinear models. Tech. rep. University of California, Los Angeles: Computer Science Department.Google Scholar
  28. Pearl, J. (2012). The causal mediation formula—a guide to the assessment of pathways and mechanisms. Prevention Science, 13, 426–436.CrossRefPubMedGoogle Scholar
  29. Petersen, M., Sinisi, S., van der Laan, M. (2006). Estimation of direct causal effects. Epidemiology, 17, 276–284.CrossRefPubMedGoogle Scholar
  30. R Development Core Team. (2014). R: A language and environment for statistical computing. R Foundation for Statistical Computing. Austria: Vienna.
  31. Robins, J., & Greenland, S. (1992). Identifiability and exchangeability for direct and indirect effects. Epidemiology, 3, 143–155.CrossRefPubMedGoogle Scholar
  32. Schmoor, C., Sauerbrei, W., Schumacher, M. (2000). Sample size considerations for the evaluation of prognostic factors in survival analysis. Statistics in Medicine, 19, 441–452.CrossRefPubMedGoogle Scholar
  33. Schoenfeld, D., & Borenstein, M. (2005). Calculating the power or sample size for the logistic and proportional hazards models. Journal of Statistical Computation and Simulation, 75, 771–785.CrossRefGoogle Scholar
  34. Self, S., & Mauritsen, R. (1988). Power/sample size calculations for generalized linear models. Biometrics, 44, 79–86.CrossRefGoogle Scholar
  35. Self, S., Mauritsen, R., Ohara, J. (1992). Power calculations for likelihood ratio tests in generalized linear models. Biometrics, 48, 31–39.CrossRefGoogle Scholar
  36. Shieh, G. (2000). On power and sample size calculations for likelihood ratio tests in generalized linear models. Biometrics, 56, 1192–1196.CrossRefPubMedGoogle Scholar
  37. Shieh, G. (2005). On power and sample size calculations for wald tests in generalized linear models. Journal of Statistical Planning and Inference, 128, 43–59.CrossRefGoogle Scholar
  38. Signorini, D. (1991). Sample size for Poisson regression. Biometrika, 78, 446–450.CrossRefGoogle Scholar
  39. Sobel, M. (1982). Asymptotic confidence intervals for indirect effects in structural equation models. In S. Leinhardt (Ed.), Sociological Methodology (pp. 290–312). American Sociological Association .Google Scholar
  40. Valeri, L., & VanderWeele, T. (2013). Mediation analysis allowing for exposure-mediator interactions and causal interpretation: Theoretical assumptions and implementation with SAS and SPSS macros. Psychological methods, 18, 1–14.Google Scholar
  41. VanderWeele, T. (2009). Marginal structural models for the estimation of direct and indirect effects. Epidemiology, 20, 18–26.CrossRefPubMedGoogle Scholar
  42. Vittinghoff, E., Sen, S., McCulloch, C. (2008). Sample size calculations for evaluating mediation. Statistics in Medicine, 28, 541–557.CrossRefGoogle Scholar
  43. Wang, E., & Xue, X. (2012). Power and sample size calculations for evaluating mediation effects in longitudinal studies. Statistical Methods in Medical Research. Available at
  44. Whittemore, A. (1981). Sample size for logistic regression with small response probability. Journal of the American Statistical Association, 76, 27–32.CrossRefGoogle Scholar
  45. Wilson, S., & Gordon, I. (1986). Calculating sample sizes in the presence of confounding variables. Applied Statistics, 35, 207–213.CrossRefGoogle Scholar

Copyright information

© Society for Prevention Research 2014

Authors and Affiliations

  1. 1.Department of Epidemiology and BiostatisticsUniversity of California San FranciscoSan FranciscoUSA
  2. 2.Department of Medicine, Center for AIDS Prevention StudiesUniversity of California San FranciscoSan FranciscoUSA

Personalised recommendations