Tutorial on causal mediation analysis with binary variables: An application to health psychology research

Health Psychol. 2023 Nov;42(11):778-787. doi: 10.1037/hea0001299. Epub 2023 Jul 6.


Mediation analysis has been widely applied to explain why and assess the extent to which an exposure or treatment has an impact on the outcome in health psychology studies. Identifying a mediator or assessing the impact of a mediator has been the focus of many scientific investigations. This tutorial aims to introduce causal mediation analysis with binary exposure, mediator, and outcome variables, with a focus on the resampling and weighting methods, under the potential outcomes framework for estimating natural direct and indirect effects. We emphasize the importance of the temporal order of the study variables and the elimination of confounding. We define the causal effects in a hypothesized causal mediation chain in the context of one exposure, one mediator, and one outcome variable, all of which are binary variables. Two commonly used and actively maintained R packages, mediation and medflex, were used to analyze a motivating example. R code examples for implementing these methods are provided. (PsycInfo Database Record (c) 2023 APA, all rights reserved).

MeSH terms

  • Behavioral Medicine*
  • Causality
  • Humans
  • Mediation Analysis
  • Models, Statistical*