IDEAS home Printed from https://ideas.repec.org/a/jss/jstsof/v076i11.html
   My bibliography  Save this article

medflex: An R Package for Flexible Mediation Analysis using Natural Effect Models

Author

Listed:
  • Steen, Johan
  • Loeys, Tom
  • Moerkerke, Beatrijs
  • Vansteelandt, Stijn

Abstract

Mediation analysis is routinely adopted by researchers from a wide range of applied disciplines as a statistical tool to disentangle the causal pathways by which an exposure or treatment affects an outcome. The counterfactual framework provides a language for clearly defining path-specific effects of interest and has fostered a principled extension of mediation analysis beyond the context of linear models. This paper describes medflex, an R package that implements some recent developments in mediation analysis embedded within the counterfactual framework. The medflex package offers a set of ready-made functions for fitting natural effect models, a novel class of causal models which directly parameterize the path-specific effects of interest, thereby adding flexibility to existing software packages for mediation analysis, in particular with respect to hypothesis testing and parsimony. In this paper, we give a comprehensive overview of the functionalities of the medflex package.

Suggested Citation

  • Steen, Johan & Loeys, Tom & Moerkerke, Beatrijs & Vansteelandt, Stijn, 2017. "medflex: An R Package for Flexible Mediation Analysis using Natural Effect Models," Journal of Statistical Software, Foundation for Open Access Statistics, vol. 76(i11).
  • Handle: RePEc:jss:jstsof:v:076:i11
    DOI: http://hdl.handle.net/10.18637/jss.v076.i11
    as

    Download full text from publisher

    File URL: https://www.jstatsoft.org/index.php/jss/article/view/v076i11/v76i11.pdf
    Download Restriction: no

    File URL: https://www.jstatsoft.org/index.php/jss/article/downloadSuppFile/v076i11/medflex_0.6-1.tar.gz
    Download Restriction: no

    File URL: https://www.jstatsoft.org/index.php/jss/article/downloadSuppFile/v076i11/v76i11.R
    Download Restriction: no

    File URL: https://libkey.io/http://hdl.handle.net/10.18637/jss.v076.i11?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    References listed on IDEAS

    as
    1. van Buuren, Stef & Groothuis-Oudshoorn, Karin, 2011. "mice: Multivariate Imputation by Chained Equations in R," Journal of Statistical Software, Foundation for Open Access Statistics, vol. 45(i03).
    2. Rhian M. Daniel & Bianca L. De Stavola & Simon N. Cousens, 2011. "gformula: Estimating causal effects in the presence of time-varying confounding or mediation using the g-computation formula," Stata Journal, StataCorp LP, vol. 11(4), pages 479-517, December.
    3. R. M. Daniel & B. L. De Stavola & S. N. Cousens & S. Vansteelandt, 2015. "Causal mediation analysis with multiple mediators," Biometrics, The International Biometric Society, vol. 71(1), pages 1-14, March.
    4. Guanglei Hong & Jonah Deutsch & Heather D. Hill, 2015. "Ratio-of-Mediator-Probability Weighting for Causal Mediation Analysis in the Presence of Treatment-by-Mediator Interaction," Mathematica Policy Research Reports 328b045b48b14d9ea3f7d0fe9, Mathematica Policy Research.
    5. Imai, Kosuke & Yamamoto, Teppei, 2013. "Identification and Sensitivity Analysis for Multiple Causal Mechanisms: Revisiting Evidence from Framing Experiments," Political Analysis, Cambridge University Press, vol. 21(2), pages 141-171, April.
    6. Kosuke Imai & Dustin Tingley & Teppei Yamamoto, 2013. "Experimental designs for identifying causal mechanisms," Journal of the Royal Statistical Society Series A, Royal Statistical Society, vol. 176(1), pages 5-51, January.
    Full references (including those not matched with items on IDEAS)

    Citations

    Citations are extracted by the CitEc Project, subscribe to its RSS feed for this item.
    as


    Cited by:

    1. Ryan M. Andrews & Ilya Shpitser & Oscar Lopez & William T. Longstreth & Paulo H. M. Chaves & Lewis Kuller & Michelle C. Carlson, 2020. "Examining the causal mediating role of brain pathology on the relationship between diabetes and cognitive impairment: the Cardiovascular Health Study," Journal of the Royal Statistical Society Series A, Royal Statistical Society, vol. 183(4), pages 1705-1726, October.
    2. Hargrove, Emily M. & Stults, Brian J. & Hay, Carter & Meldrum, Ryan C., 2023. "Sleep duration as a mediator of the effects of risk factors for substance use," Journal of Criminal Justice, Elsevier, vol. 88(C).
    3. Anita Lindmark, 2022. "Sensitivity analysis for unobserved confounding in causal mediation analysis allowing for effect modification, censoring and truncation," Statistical Methods & Applications, Springer;Società Italiana di Statistica, vol. 31(4), pages 785-814, October.
    4. Krisztián Pósch, 2021. "Testing Complex Social Theories With Causal Mediation Analysis and G-Computation: Toward a Better Way to Do Causal Structural Equation Modeling," Sociological Methods & Research, , vol. 50(3), pages 1376-1406, August.
    5. Caubet, Miguel & Samoilenko, Mariia & Drouin, Simon & Sinnett, Daniel & Krajinovic, Maja & Laverdière, Caroline & Marcil, Valérie & Lefebvre, Geneviève, 2023. "Bayesian joint modeling for causal mediation analysis with a binary outcome and a binary mediator: Exploring the role of obesity in the association between cranial radiation therapy for childhood acut," Computational Statistics & Data Analysis, Elsevier, vol. 177(C).
    6. Martin Huber & Yu‐Chin Hsu & Ying‐Ying Lee & Layal Lettry, 2020. "Direct and indirect effects of continuous treatments based on generalized propensity score weighting," Journal of Applied Econometrics, John Wiley & Sons, Ltd., vol. 35(7), pages 814-840, November.
    7. N. Dardenne & B. Pétré & E. Husson & M. Guillaume & A. F. Donneau, 2020. "Assessing Quality of Life in an Obesity Observational Study: a Structural Equation Modeling Approach," Applied Research in Quality of Life, Springer;International Society for Quality-of-Life Studies, vol. 15(4), pages 1117-1133, September.
    8. Nevo Daniel & Liao Xiaomei & Spiegelman Donna, 2017. "Estimation and Inference for the Mediation Proportion," The International Journal of Biostatistics, De Gruyter, vol. 13(2), pages 1-18, November.
    9. Meldrum, Ryan C. & Stults, Brian J. & Hay, Carter & Kernsmith, Poco D. & Smith-Darden, Joanne P., 2022. "Adverse childhood experiences, developmental differences in impulse control and sensation seeking, and delinquency: A prospective multi-cohort study," Journal of Criminal Justice, Elsevier, vol. 82(C).
    10. Gerd Toril Mørkve Knudsen & Shyamali Dharmage & Christer Janson & Michael J Abramson & Bryndís Benediktsdóttir & Andrei Malinovschi & Svein Magne Skulstad & Randi Jacobsen Bertelsen & Francisco Gomez , 2020. "Parents’ smoking onset before conception as related to body mass index and fat mass in adult offspring: Findings from the RHINESSA generation study," PLOS ONE, Public Library of Science, vol. 15(7), pages 1-20, July.
    11. Tat-Thang Vo & Hilary Davies-Kershaw & Ruth Hackett & Stijn Vansteelandt, 2022. "Longitudinal mediation analysis of time-to-event endpoints in the presence of competing risks," Lifetime Data Analysis: An International Journal Devoted to Statistical Methods and Applications for Time-to-Event Data, Springer, vol. 28(3), pages 380-400, July.

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Guanglei Hong & Fan Yang & Xu Qin, 2023. "Posttreatment confounding in causal mediation studies: A cutting‐edge problem and a novel solution via sensitivity analysis," Biometrics, The International Biometric Society, vol. 79(2), pages 1042-1056, June.
    2. Acharya, Avidit & Blackwell, Matthew & Sen, Maya, 2016. "Explaining Causal Findings Without Bias: Detecting and Assessing Direct Effects," American Political Science Review, Cambridge University Press, vol. 110(3), pages 512-529, August.
    3. Xu Qin & Jonah Deutsch & Guanglei Hong, 2021. "Unpacking Complex Mediation Mechanisms And Their Heterogeneity Between Sites In A Job Corps Evaluation," Journal of Policy Analysis and Management, John Wiley & Sons, Ltd., vol. 40(1), pages 158-190, January.
    4. Zhao, Yi & Luo, Xi, 2023. "Multilevel mediation analysis with structured unmeasured mediator-outcome confounding," Computational Statistics & Data Analysis, Elsevier, vol. 179(C).
    5. Tingley, Dustin & Yamamoto, Teppei & Hirose, Kentaro & Keele, Luke & Imai, Kosuke, 2014. "mediation: R Package for Causal Mediation Analysis," Journal of Statistical Software, Foundation for Open Access Statistics, vol. 59(i05).
    6. Nicholas Weller & Jeb Barnes, 2016. "Pathway Analysis and the Search for Causal Mechanisms," Sociological Methods & Research, , vol. 45(3), pages 424-457, August.
    7. Soojin Park & Peter M. Steiner & David Kaplan, 2018. "Identification and Sensitivity Analysis for Average Causal Mediation Effects with Time-Varying Treatments and Mediators: Investigating the Underlying Mechanisms of Kindergarten Retention Policy," Psychometrika, Springer;The Psychometric Society, vol. 83(2), pages 298-320, June.
    8. Adam C. Sales, 2017. "Review," Journal of Educational and Behavioral Statistics, , vol. 42(1), pages 69-84, February.
    9. Jing Peng, 2023. "Identification of Causal Mechanisms from Randomized Experiments: A Framework for Endogenous Mediation Analysis," Information Systems Research, INFORMS, vol. 34(1), pages 67-84, March.
    10. Tyler J. VanderWeele & Eric J. Tchetgen Tchetgen, 2017. "Mediation analysis with time varying exposures and mediators," Journal of the Royal Statistical Society Series B, Royal Statistical Society, vol. 79(3), pages 917-938, June.
    11. Ward, Jeffrey T. & Hartley, Richard D. & Tillyer, Rob, 2016. "Unpacking gender and racial/ethnic biases in the federal sentencing of drug offenders: A causal mediation approach," Journal of Criminal Justice, Elsevier, vol. 46(C), pages 196-206.
    12. Gay, Victor & Boehnke, Jörn, 2017. "The Missing Men: World War I and Female Labor Participation," MPRA Paper 77560, University Library of Munich, Germany.
    13. Martin Huber, 2015. "Causal Pitfalls in the Decomposition of Wage Gaps," Journal of Business & Economic Statistics, Taylor & Francis Journals, vol. 33(2), pages 179-191, April.
    14. Cai, Xizhen & Zhu, Yeying & Huang, Yuan & Ghosh, Debashis, 2022. "High-dimensional causal mediation analysis based on partial linear structural equation models," Computational Statistics & Data Analysis, Elsevier, vol. 174(C).
    15. Haiyan Liu & Ick Hoon Jin & Zhiyong Zhang & Ying Yuan, 2021. "Social Network Mediation Analysis: A Latent Space Approach," Psychometrika, Springer;The Psychometric Society, vol. 86(1), pages 272-298, March.
    16. Guanglei Hong & Xu Qin & Fan Yang, 2018. "Weighting-Based Sensitivity Analysis in Causal Mediation Studies," Journal of Educational and Behavioral Statistics, , vol. 43(1), pages 32-56, February.
    17. R. M. Daniel & B. L. De Stavola & S. N. Cousens & S. Vansteelandt, 2015. "Causal mediation analysis with multiple mediators," Biometrics, The International Biometric Society, vol. 71(1), pages 1-14, March.
    18. Xu Qin & Guanglei Hong, 2017. "A Weighting Method for Assessing Between-Site Heterogeneity in Causal Mediation Mechanism," Journal of Educational and Behavioral Statistics, , vol. 42(3), pages 308-340, June.
    19. Soojin Park & Kevin M. Esterling, 2021. "Sensitivity Analysis for Pretreatment Confounding With Multiple Mediators," Journal of Educational and Behavioral Statistics, , vol. 46(1), pages 85-108, February.
    20. Noémi Kreif & Richard Grieve & Iván Díaz & David Harrison, 2015. "Evaluation of the Effect of a Continuous Treatment: A Machine Learning Approach with an Application to Treatment for Traumatic Brain Injury," Health Economics, John Wiley & Sons, Ltd., vol. 24(9), pages 1213-1228, September.

    More about this item

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:jss:jstsof:v:076:i11. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Christopher F. Baum (email available below). General contact details of provider: http://www.jstatsoft.org/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.