# MediationResult


Mediation analysis results.


Usage

``` python
MediationResult(
    total_effect,
    direct_effect,
    indirect_effect,
    proportion_mediated,
    total_se,
    direct_se,
    indirect_se,
    n_obs,
)
```


Returned by [mediation_analysis()](mediation_analysis.md#whittaker.mediation_analysis). Decomposes the total effect of a treatment on an outcome into a direct component (not passing through the mediator) and an indirect component (passing through the mediator), following the potential-outcomes framework of Imai, Keele, & Tingley (2010). Standard errors are obtained by a nonparametric bootstrap over the whole estimation procedure (refitting both the mediator and outcome GAMs on each resample).


## Attributes


`total_effect: float`  
Total effect of treatment on outcome, `direct_effect + indirect_effect`.

`direct_effect: float`  
Direct effect of treatment on outcome, holding the mediator fixed at its value under treatment (natural direct effect).

`indirect_effect: float`  
Indirect effect of treatment on outcome operating through the mediator (natural indirect effect).

`proportion_mediated: float`  
Fraction of the total effect attributable to the mediator, `indirect_effect / total_effect`.

`total_se: float`  
Bootstrap standard error of the total effect.

`direct_se: float`  
Bootstrap standard error of the direct effect.

`indirect_se: float`  
Bootstrap standard error of the indirect effect.

`n_obs: int`  
Number of observations.
