Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation
Randomized Controlled Trial
. 2023 Jun 14;18(6):e0287037.
doi: 10.1371/journal.pone.0287037. eCollection 2023.

BayesGmed: An R-package for Bayesian causal mediation analysis

Affiliations
Randomized Controlled Trial

BayesGmed: An R-package for Bayesian causal mediation analysis

Belay B Yimer et al. PLoS One. .

Abstract

Background: The past decade has seen an explosion of research in causal mediation analysis. However, most analytic tools developed so far rely on frequentist methods which may not be robust in the case of small sample sizes. In this paper, we propose a Bayesian approach for causal mediation analysis based on Bayesian g-formula, which will overcome the limitations of the frequentist methods.

Methods: We created BayesGmed, an R-package for fitting Bayesian mediation models in R. The application of the methodology (and software tool) is demonstrated by a secondary analysis of data collected as part of the MUSICIAN study, a randomised controlled trial of remotely delivered cognitive behavioural therapy (tCBT) for people with chronic pain. We tested the hypothesis that the effect of tCBT would be mediated by improvements in active coping, passive coping, fear of movement and sleep problems. We then demonstrate the use of informative priors to conduct probabilistic sensitivity analysis around violations of causal identification assumptions.

Result: The analysis of MUSICIAN data shows that tCBT has better-improved patients' self-perceived change in health status compared to treatment as usual (TAU). The adjusted log-odds of tCBT compared to TAU range from 1.491 (95% CI: 0.452-2.612) when adjusted for sleep problems to 2.264 (95% CI: 1.063-3.610) when adjusted for fear of movement. Higher scores of fear of movement (log-odds, -0.141 [95% CI: -0.245, -0.048]), passive coping (log-odds, -0.217 [95% CI: -0.351, -0.104]), and sleep problem (log-odds, -0.179 [95% CI: -0.291, -0.078]) leads to lower odds of a positive self-perceived change in health status. The result of BayesGmed, however, shows that none of the mediated effects are statistically significant. We compared BayesGmed with the mediation R- package, and the results were comparable. Finally, our sensitivity analysis using the BayesGmed tool shows that the direct and total effect of tCBT persists even for a large departure in the assumption of no unmeasured confounding.

Conclusion: This paper comprehensively overviews causal mediation analysis and provides an open-source software package to fit Bayesian causal mediation models.

PubMed Disclaimer

Conflict of interest statement

The authors have declared that no competing interests exist.

Figures

Fig 1
Fig 1. Causal directed acyclic graph (DAG) for the MUSICIAN study.
Fig 2
Fig 2. Mediation with a single mediator M, exposure A, outcome Y, and confounders Z.
Fig 3
Fig 3. MUSICIAN trial: Bayesian sensitivity analysis for varying levels of departure from no-unmeasured confounder assumptions.

References

    1. Robins J.M. and Greenland S., Identifiability and exchangeability for direct and indirect effects. Epidemiology, 1992: p. 143–155. doi: 10.1097/00001648-199203000-00013 - DOI - PubMed
    1. Pearl, J., Causal inference in statistics: a gentle introduction. 2001.
    1. VanderWeele T.J. and Vansteelandt S., Conceptual issues concerning mediation, interventions and composition. Statistics and its Interface, 2009. 2(4): p. 457–468.
    1. Imai K., Keele L., and Yamamoto T., Identification, inference and sensitivity analysis for causal mediation effects. Statistical science, 2010. 25(1): p. 51–71.
    1. Imai K. and Yamamoto T., Identification and sensitivity analysis for multiple causal mechanisms: Revisiting evidence from framing experiments. Political Analysis, 2013. 21(2): p. 141–171.

Publication types

LinkOut - more resources