rwrmed: Regression-with-residuals (RWR) Analysis of Causal Mediation.

This packages implements the regression-with-residuals (RWR) approach to causal mediation analysis, allowing for post-treatment confounding of the mediator-outcome relationship (Zhou and Wodtke 2019; Wodtke and Zhou 2019). The rwrmed() function fits user-specified mediator and outcome models with residualized post-treatment confounders. The decomp() function implements a two-component decomposition of the total effect into the randomized interventional analogues of the natural direct effect (rNDE) and the natural indirect effect (rNIE), as well as a four-component decomposition of the total effect into the controlled direct effect (CDE) and the randomized analogues of the reference interaction effect (rINTREF), the mediated interaction effect (rINTMED), and the pure indirect effect (rPIE).