European Journal of Epidemiology

, Volume 30, Issue 10, pp 1119–1127 | Cite as

G-computation demonstration in causal mediation analysis

  • Aolin Wang
  • Onyebuchi A. Arah


Recent work has considerably advanced the definition, identification and estimation of controlled direct, and natural direct and indirect effects in causal mediation analysis. Despite the various estimation methods and statistical routines being developed, a unified approach for effect estimation under different effect decomposition scenarios is still needed for epidemiologic research. G-computation offers such unification and has been used for total effect and joint controlled direct effect estimation settings, involving different types of exposure and outcome variables. In this study, we demonstrate the utility of parametric g-computation in estimating various components of the total effect, including (1) natural direct and indirect effects, (2) standard and stochastic controlled direct effects, and (3) reference and mediated interaction effects, using Monte Carlo simulations in standard statistical software. For each study subject, we estimated their nested potential outcomes corresponding to the (mediated) effects of an intervention on the exposure wherein the mediator was allowed to attain the value it would have under a possible counterfactual exposure intervention, under a pre-specified distribution of the mediator independent of any causes, or under a fixed controlled value. A final regression of the potential outcome on the exposure intervention variable was used to compute point estimates and bootstrap was used to obtain confidence intervals. Through contrasting different potential outcomes, this analytical framework provides an intuitive way of estimating effects under the recently introduced 3- and 4-way effect decomposition. This framework can be extended to complex multivariable and longitudinal mediation settings.


G-computation Parametric g-formula Mediation analysis Effect decomposition Simulation 



AW was supported by a doctoral scholarship from the Chinese Scholarship Council (CSC), and the Dissertation Year Fellowship from the University of California, Los Angeles. OAA was partly supported by grant R01-HD072296-01A1 from the Eunice Kennedy Shriver National Institute of Child Health and Human Development (NICHD). The authors benefited from facilities and resources provided by the California Center for Population Research at UCLA (CCPR), which receives core support (R24-HD041022) from the Eunice Kennedy Shriver NICHD.

Supplementary material

10654_2015_100_MOESM1_ESM.docx (86 kb)
Supplementary material 1 (DOCX 86 kb)


  1. 1.
    Robins J. A new approach to causal inference in mortality studies with a sustained exposure period—application to control of the healthy worker survivor effect. Math Model. 1986;7(9–12):1393–512.CrossRefGoogle Scholar
  2. 2.
    Robins JM, Hernan MA. Estimation of the causal effects of time-varying exposures. In: Verbeke G, Davidian M, Fitzmaurice G, Molenberghs G, editors. Longitudinal data analysis. London: Chapman and Hall/CRC; 2009. p. 553–99.Google Scholar
  3. 3.
    Imai K, Keele L. Tingley DA general approach to causal mediation analysis. Psychol Methods. 2010;15(4):309–34.CrossRefPubMedGoogle Scholar
  4. 4.
    Daniel RM, De Stavola BL, Cousens SN. gformula: estimating causal effects in the presence of time-varying confounding or mediation using the g-computation formula. Stata J. 2011;11(4):479–517.Google Scholar
  5. 5.
    Valeri L, Vanderweele TJ. Mediation analysis allowing for exposure–mediator interactions and causal interpretation: theoretical assumptions and implementation with SAS and SPSS macros. Psychol Methods. 2013;18(2):137–50.PubMedCentralCrossRefPubMedGoogle Scholar
  6. 6.
    Snowden JM, Rose S, Mortimer KM. Implementation of G-computation on a simulated data set: demonstration of a causal inference technique. Am J Epidemiol. 2011;173(7):731–8.PubMedCentralCrossRefPubMedGoogle Scholar
  7. 7.
    VanderWeele T, Tchetgen ET. Mediation analysis with time-varying exposures and mediators. Harvard Univ Biostat Work Pap Ser. 2014. Working Paper 168.
  8. 8.
    VanderWeele TJ. A three-way decomposition of a total effect into direct, indirect, and interactive effects. Epidemiology. 2013;24(2):224–32.PubMedCentralCrossRefPubMedGoogle Scholar
  9. 9.
    VanderWeele TJ. A unification of mediation and interaction: a 4-way decomposition. Epidemiology. 2014;25(5):749–61.PubMedCentralCrossRefPubMedGoogle Scholar
  10. 10.
    Vansteelandt S. Estimation of direct and indirect effects. In: Berzuini C, Dawid P, Bernardinelli L, editors. Causality: statistical perspectives and applications. Chichester: Wiley; 2012. p. 126–50.CrossRefGoogle Scholar
  11. 11.
    Robins JM, Greenland S. Identifiability and exchangeability for direct and indirect effects. Epidemiology. 1992;3(2):143–55.CrossRefPubMedGoogle Scholar
  12. 12.
    Pearl J. Direct and indirect effects. In: Proceedings of the seventeenth conference on uncertainty in artificial intelligence. San Francisco: Morgan Kaufmann; 2001. p. 411–20.
  13. 13.
    Naimi AI, Moodie EEM, Auger N, Kaufman JS. Stochastic mediation contrasts in epidemiologic research: interpregnancy interval and the educational disparity in preterm delivery. Am J Epidemiol. 2014;180(4):436–45.CrossRefPubMedGoogle Scholar
  14. 14.
    Rubin DB. Discussion of “Randomization analysis of experimental data in the Fisher randomization test” by Basu. J Am Stat Assoc. 1980;75(371):591–3.Google Scholar
  15. 15.
    Rubin DB. Neyman (1923) and causal inference in experiments and observational studies. Stat Sci. 1990;5:472–80.Google Scholar
  16. 16.
    Robins JM, Hernán MA, Brumback B. Marginal structural models and causal inference in epidemiology. Epidemiology. 2000;11:550–60.CrossRefPubMedGoogle Scholar
  17. 17.
    Hernán MA, Robins JM. Estimating causal effects from epidemiological data. J Epidemiol Community Health. 2006;60:578–86.PubMedCentralCrossRefPubMedGoogle Scholar
  18. 18.
    Vanderweele TJ, Vansteelandt S, Robins JM. Effect decomposition in the presence of an exposure-induced mediator–outcome confounder. Epidemiology. 2014;25:300–6.PubMedCentralCrossRefPubMedGoogle Scholar
  19. 19.
    Imai K, Keele L, Tingley D, Yamamoto T. Unpacking the black box of causality: learning about causal mechanisms from experimental and observational studies. Am Polit Sci Rev. 2011;105:765–89.CrossRefGoogle Scholar
  20. 20.
    VanderWeele TJ. Bias formulas for sensitivity analysis for direct and indirect effects. Epidemiology. 2010;21:540–51.PubMedCentralCrossRefPubMedGoogle Scholar
  21. 21.
    Richardson TS, Robins JM. Single world intervention graphs (SWIGs): a unification of the counterfactual and graphical approaches to causality. 2013.
  22. 22.
    Naimi AI, Kaufman JS, MacLehose RF. Mediation misgivings: ambiguous clinical and public health interpretations of natural direct and indirect effects. Int J Epidemiol. 2014;43(5):1656–61.CrossRefPubMedGoogle Scholar
  23. 23.
    Tchetgen Tchetgen EJ. Vanderweele TJ. Identification of natural direct effects when a confounder of the mediator is directly affected by exposure. Epidemiology. 2014;25(2):282–91.CrossRefPubMedGoogle Scholar
  24. 24.
    Daniel RM, De Stavola BL, Cousens SN, Vansteelandt S. Causal mediation analysis with multiple mediators. Biometrics. 2015;71:1–14.PubMedCentralCrossRefPubMedGoogle Scholar
  25. 25.
    Daniel RM, Cousens SN, De Stavola BL, Kenward MG, Sterne JAC. Methods for dealing with time-dependent confounding. Stat Med. 2013;32:1584–618.CrossRefPubMedGoogle Scholar
  26. 26.
    Keil AP, Edwards JK, Richardson DB, Naimi AI, Cole SR. The parametric G-formula for time-to-event data: intuition and a worked example. Epidemiology. 2014;25:889–97.PubMedCentralCrossRefPubMedGoogle Scholar
  27. 27.
    Young JG, Cain LE, Robins JM, O’Reilly EJ, Hernán MA. Comparative effectiveness of dynamic treatment regimes: an application of the parametric g-formula. Stat Biosci. 2011;3:119–43.PubMedCentralCrossRefPubMedGoogle Scholar
  28. 28.
    Westreich D, Cole SR, Young JG, Palella F, Tien PC, Kingsley L, et al. The parametric g-formula to estimate the effect of highly active antiretroviral therapy on incident AIDS or death. Stat Med. 2012;31:2000–9.PubMedCentralCrossRefPubMedGoogle Scholar
  29. 29.
    Ahern J, Hubbard A, Galea S. Estimating the effects of potential public health interventions on population disease burden: a step-by-step illustration of causal inference methods. Am J Epidemiol. 2009;169:1140–7.PubMedCentralCrossRefPubMedGoogle Scholar
  30. 30.
    Taubman SL, Robins JM, Mittleman MA, Hernán MA. Intervening on risk factors for coronary heart disease: an application of the parametric g-formula. Int J Epidemiol. 2009;38:1599–611.PubMedCentralCrossRefPubMedGoogle Scholar
  31. 31.
    Cole SR, Richardson DB, Chu H, Naimi AI. Analysis of occupational asbestos exposure and lung cancer mortality using the g formula. Am J Epidemiol. 2013;177:989–96.PubMedCentralCrossRefPubMedGoogle Scholar
  32. 32.
    Danaei G, Pan A, Hu FB, Hernán MA. Hypothetical midlife interventions in women and risk of type 2 diabetes. Epidemiology. 2013;24:122–8.PubMedCentralCrossRefPubMedGoogle Scholar
  33. 33.
    Garcia-Aymerich J, Varraso R, Danaei G, Camargo CA, Hernán MA. Incidence of adult-onset asthma after hypothetical interventions on body mass index and physical activity: an application of the parametric g-formula. Am J Epidemiol. 2014;179:20–6.PubMedCentralCrossRefPubMedGoogle Scholar
  34. 34.
    Pearl J. Causal diagrams for empirical research. Biometrika. 1995;82(4):669–88.CrossRefGoogle Scholar
  35. 35.
    World Health Organization. World Health Survey: guide to administration and question by question specifications. Geneva. 2002. Accessed 22 Oct 2015.
  36. 36.
    Simpson EH. The interpretation of interaction in contingency tables. J R Stat Soc Ser B. 1951;13:238–41.Google Scholar
  37. 37.
    Vansteelandt S, Bekaert M, Lange T. Imputation strategies for the estimation of natural direct and indirect effects. Epidemiol Method. 2012;1(1):131–58.CrossRefGoogle Scholar
  38. 38.
    Tchetgen EJT, Shpitser I. Semiparametric theory for causal mediation analysis: efficiency bounds, multiple robustness and sensitivity analysis. Ann Stat. 2012;40(3):1816–45.CrossRefGoogle Scholar
  39. 39.
    Tchetgen Tchetgen E, Shpitser I. Semiparametric estimation of models for natural direct and indirect effects. Harvard Univ Biostat Work Pap Ser. 2011.Google Scholar
  40. 40.
    Van der Laan MJ, Petersen ML. Direct effect models. Int J Biostat. 2008;4(1):1–27.Google Scholar
  41. 41.
    VanderWeele TJ. Marginal structural models for the estimation of direct and indirect effects. Epidemiology. 2009;20(1):18–26.CrossRefPubMedGoogle Scholar
  42. 42.
    Imai K, Keele L, Yamamoto T. Identification, inference and sensitivity analysis for causal mediation effects. Stat Sci. 2010;25(1):51–71.CrossRefGoogle Scholar
  43. 43.
    Albert JM. Distribution-free mediation analysis for nonlinear models with confounding. Epidemiology. 2012;23(6):879–88.PubMedCentralCrossRefPubMedGoogle Scholar
  44. 44.
    Zhang YT, Laraia BA, Mujahid MS, et al. Does food vendor density mediate the association between neighborhood deprivation and BMI? Epidemiology. 2015;26(3):344–52.PubMedCentralCrossRefPubMedGoogle Scholar
  45. 45.
    Jackson JW, VanderWeele TJ, Viswanathan A, Blacker D, Schneeweiss S. The explanatory role of stroke as a mediator of the mortality risk difference between older adults who initiate first- versus second-generation antipsychotic drugs. Am J Epidemiol. 2014;180(8):847–52.PubMedCentralCrossRefPubMedGoogle Scholar
  46. 46.
    Hernán MA. Invited commentary: agent-based models for causal inference—reweighting data and theory in epidemiology. Am J Epidemiol. 2015;181(2):103–5.CrossRefPubMedGoogle Scholar
  47. 47.
    Pearl J. The causal mediation formula—a guide to the assessment of pathways and mechanisms. Prev Sci. 2012;13(4):426–36.CrossRefPubMedGoogle Scholar
  48. 48.
    Imai K, Keele L, Tingley D, Yamamoto T. Unpacking the black box: learning about causal mechanisms from experimental and observational studies. Am Polit Sci Rev. 2011;105(4):765–89.CrossRefGoogle Scholar

Copyright information

© Springer Science+Business Media Dordrecht 2015

Authors and Affiliations

  1. 1.Department of Epidemiology, Fielding School of Public HealthUniversity of California, Los Angeles (UCLA)Los AngelesUSA
  2. 2.California Center for Population Research (CCPR)Los AngelesUSA
  3. 3.UCLA Center for Health Policy ResearchLos AngelesUSA

Personalised recommendations