class: center, middle, inverse, title-slide # Mediation ##
Part 4 of Summary of the Harvard Workshop on Causal Modelling
### Chris Oldmeadow ### CReDITSS, HMRI ### 2019-10-14 --- # Mediation .pull-left[ <img src="index_files/figure-html/unnamed-chunk-1-1.png" width="504" /> ] .pull-right[ <img src="index_files/figure-html/unnamed-chunk-2-1.png" width="504" /> ] ??? * Best to have 3 waves of data: Exposure -> Mediator -> Outcome Baseline values of the mediator and outcome can be controlled for as confounders * Can use cross-sectional data, provided the causal relationships are established * If there are many waves of data, there are more advanced methods that can deal with this --- <img src="index_files/figure-html/unnamed-chunk-3-1.png" width="504" style="display: block; margin: auto;" /> * .blue[(1) Indirect effect] of A on Y through M * .blue[(2) Direct effect] of A on Y (effect that is not through M) --- # Standard approach (The difference method) * Total effect: `\(E[Y|A=a,C=c] = \alpha_0 + \alpha_1A + ...\)` * Indirect effect: `\(E[Y|A=a,C=c,M=m] = \beta_0 +\beta_1A + ...\)` Direct effect = Total effect - Indirect effect --- class: center, inverse , middle # Problem 1: Mediator outcome confounding --- ## Adjusting for M creates collider stratification bias <img src="index_files/figure-html/unnamed-chunk-4-1.png" width="504" style="display: block; margin: auto;" /> --- class: center, inverse , middle # Problem 2: Exposure-mediator interactions ??? When interaction we would have 2 direct effects (one for each level of the mediator), so it isnt clear how to then work out the indirect effect --- # Counterfactual framework for mediation ## Some definitions .content-box-blue[ - `\(Y_a\)`: counterfactual **outcome** when exposure `\(A\)` is set to level `\(a\)` - `\(M_a\)`: be the counterfactual value of the **mediator** when exposure `\(A\)` is set to level `\(a\)` - `\(Y_{am}\)`: counterfactual outcome when exposure `\(A\)` is set to `\(a\)` and `\(M\)` to `\(m\)`] --- class: middle, center # Total effect `$$Y_{1M_1} - Y_{0M_0}$$` --- ## Nested counterfactuals `$$Y_{aM_a*}$$` For example: `$$Y_{0M_1}$$` The counterfactual outcome had you not received the treatment, but mediator at the counterfactual value it would have been had you received treatment. | A | M | Y | `\(M_0\)` | `\(M_1\)` | `\(Y_{0M_0}\)` | `\(Y_{1M_1}\)` | `\(Y_{0M_1}\)` | `\(Y_{1M_0}\)` | |---|---|---|-----|-----|---------|---------|---------|---------| | 0 | 0 | 1 | 0 | | 1 | | | | | 1 | 0 | 1 | | 0 | | 0 | | | | 1 | 1 | 0 | | 1 | | 0 | | | --- # Controlled Direct effect (CDE) .content-box-blue[The difference in counterfactual outcomes when `\(A=1\)` compared to `\(A=0\)`, when `\(M\)` is fixed at `\(m\)`] `$$E[CDE(m)|c] = E[Y|A=1,m,c] - E[Y|A=0,m,c]$$` --- # Natural Direct Effect (NDE) .content-box-blue[Changing the treatment, but fixing the mediator at whatever level it would be had you not changed the treatment] `$$E[NDE|C] = E[Y_{1,M_0}- Y_{0,M_0}|C]$$` `$$=\Sigma_m \{E[Y|A=1,m,c]-E[Y|A=0,m,c]\}P(M=m|A=0,c)$$` ??? is the effect you see by changing the mediator, as if you had changed the treatment without actually changing the treatment itself. The NDE captures the effect of the exposure if we could disable the path through the mediator , c/w CDE where the mediator is fixed at the same value for everybody eg a policy --- # Natural Indirect Effect (NIE) .content-box-blue[Fixing the treatment, the effect you see by changing the mediator, as if you had changed the treatment without actually changing the treatment itself] `$$E[NIE|C] = E[Y_{1,M_1} - Y_{1,M_0}|C]$$` `$$= \Sigma_m E[Y|A=1,m,c] \{P(M=m|A=1,c)-P(M=m|A=0,c)\}$$` ??? The NIE captures the effect of the exposure on the outcome by changing the mediator What change would occur to the outcome if one changes the mediator from the value that would be realized under the control condition, Mi(0), to the value that would be observed under the treatment condition, Mi(1), while holding the treatment status at t --- # Proportion mediated .content-box-blue[Total effect = NIE + NDE] PM = NIE/TE * is imprecise (ie wide confidence intervals) * Use the CI for the NIE to decide if there is any mediation occurring --- # Identification: Parametric regression equations * Fit a regression model `\(E[Y|A,M,C] = \theta_0 + \theta_1a + \theta_2m + \theta_3am + \beta_3c\)` * Fit a regression model `\(E[M|A,C] = \beta_0 + \beta_1a + \beta_2c\)` * compute analytically --- # Analytic solutions - `\(CDE = \theta_1 + \theta_3m (a-a^{\star})\)` - `\(NDE = \theta_1 + \theta_3(\beta_0+\beta_1a^{\star} + \beta_3c) (a-a^{\star})\)` - `\(NIE = \theta_2\times\beta_1 + \theta_3\times\beta_1a(a-a^{\star})\)` --- # Monte Carlo Simulation (Very similar to chained regression equations for MI) 1. Fit model for M|A,C and Y|M,A,C using observed data 2. For each treatment level (eg A=0 and 1): - simulate the potential values for M|A - simulate the potential values for Y conditional on M and the value for A -average over these Confidence intervals taken from the percentiles form the bootstrapped samples --- # Assumptions<sup>1,2</sup> .content-box-blue[ 1. No unmeasured exposure-outcome confounders 2. No unmeasured mediator-outcome confounders 3. No unmeasured exposure-mediator confounders 4. **There is no mediator-outcome confounder that is affected by exposure** ] .footnote[ [1] CDE only requires assumptions 1-2. [2] Randomisation ensures 1 and 3 hold. ] --- ## How do we deal with L when trying to estimate the CDE? .pull-left[ <img src="index_files/figure-html/unnamed-chunk-5-1.png" width="504" /> ] .pull-right[ - Do we control for L 🤷 {{content}} ] -- - If we dont then confounding bias 😱 {{content}} -- - if we do then we eliminate some of the effect of A through pathways other than M 😱 {{content}} -- - Seem familiar?? --- # Marginal Structural Model for mediation - Weight for p(A|C) - weight for p(M|A,C,L) - overall weight = --- # Sensitivity analysis * E-value = RR + sqrt(RR*(RR-1)). The minimum confounding risk ratio (RR_{UY} and RR_{AU}) that would explain away any effect and its CI ??? * Too often in RCT's, no thought goes in to measuring all known mediator-outcome confounders * Sensitivity analysis can help here --- class: center, middle, inverse # Thanks [**Slides**](https://chrisoldmeadow.github.io/MediationTalk/#1) created via the R package [**xaringan**](https://github.com/yihui/xaringan). DAGs created via the R packages [**Dagitty**](https://github.com/jtextor/dagitty) and [**ggdag**](https://github.com/malcolmbarrett/ggdag)