Probabilistic Programming in Causal Inference
Can probabilistic programming answer causal questions from observational data more accurately than established alternatives?
Overview
Standard statistical methods often conflate correlation with causation in observational data. This project frames causal inference within Pearl’s structural causal model (SCM) framework, encodes causal structure as directed acyclic graphs (DAGs), and benchmarks four methods on synthetic data before applying the best approach to a real medical question.
Two case studies:
- Synthetic benchmark: ice cream sales data with known ground truth, used to validate all four methods against a verifiable answer
- Vitamin D and Depression: NHANES 2015-2016 public health data (n = 1,628), asking whether raising serum vitamin D levels causally reduces depressive symptoms
Methods
All four methods are framed around Pearl’s causal hierarchy: association, intervention, and counterfactual.
| Method | Intervention | Counterfactual |
|---|---|---|
| Do-calculus (linear regression) | Yes | Yes |
| Propensity Score Matching (PSM) | Yes | No |
| Causal Forests (econml) | Yes | Yes |
| Probabilistic Programming (Turing.jl) | Yes | Yes |
The probabilistic programming model encodes all causal relationships as a joint probabilistic model. Continuous variables are sampled with HMC; discrete variables with Particle Gibbs. Model coefficients are initialised via MAP estimation before running MCMC.
Key Results
On the synthetic benchmark, the PPL model achieved roughly 2x lower RMSE than do-calculus for both intervention and counterfactual queries, by explicitly modelling noise in every variable rather than assuming a linear mean function.
On the Vitamin D case study, both counterfactual queries returned inconclusive results (CIs containing zero), consistent with recent literature questioning the causal link between vitamin D supplementation and depression outcomes. The result may also reflect limitations of the depression proxy used (single questionnaire item vs. validated instruments like the BDI).
Stack
Julia (Turing.jl, Optim.jl) · Python (scikit-learn, econml, statsmodels) · R (dagitty, ggdag)