Distributional mediation analysis using energy regression.
Overview
dma implements causal mediation analysis with engression for nuisance estimation. The point of using a distributional regression method is that the counterfactual outcome distribution can change in ways that are not summarized by a conditional mean. The package supports four effect decompositions:
- Natural (N): Direct and indirect effects
- Organic (O): Organic direct and indirect effects
- Randomized Interventional (RI): RIDE and RIIE
- Recanting Twins (RT): Four-way path decomposition
The estimands follow Liu, Williams, Rudolph, and Diaz (2024). Here engression is used for both the outcome regressions and the Riesz-representer density-ratio steps.
Quick Start
library(dmaR)
result <- dma(
data = df,
trt = "A",
outcome = "Y",
mediators = "M",
covar = "W",
effect = "N",
d0 = \(data, trt) 0,
d1 = \(data, trt) 1
)
print(result)
tidy(result)
plot(result)
# Counterfactual density plots
plot_counterfactual_density(result) # marginal P(Y|do(A=a))
plot_counterfactual_density(result, use_weights = TRUE) # all mediation regimesWhat is included
- Distributional outcome regression via
engression(learns full P(Y|X), not just E[Y|X]) - Neural network Riesz representer estimation for density ratios
- Cross-fitting with parallel fold processing via
future.apply - Observation weights propagated through all nuisance estimation stages
- Coefficient plots and counterfactual density visualization
- Weighted counterfactual density estimation for the mediation regimes
Vignettes
Full documentation: https://xiangao.github.io/dma/
| Vignette | Description |
|---|---|
| Distributional mediation analysis | Comparison with crumble on natural and organic effects, oracle vs estimated distributions, Monte Carlo study |
| Distributional mediation | Non-linear DGP demonstrating distributional mediation with weighted counterfactual densities |
| Effect types | All four effect decompositions (N, O, RI, RT) with oracle potential outcome distributions |
| Advantages of engression | When distributional regression outperforms conditional mean methods |