Causal inference for when randomization is impossible
Bayesian causal inference for quasi-experiments, shipping credible intervals and practical-significance tests where randomized controls don't exist.

What it does
CausalPy provides a Python toolkit for analyzing natural experiments—policy rollouts, geographic lifts, threshold-based eligibility rules, and staggered adoptions. It implements methods like difference-in-differences, synthetic control, regression discontinuity, and instrumental variables, estimating effects through PyMC’s Bayesian machinery or traditional OLS via scikit-learn. Every analysis returns effect summaries with uncertainty intervals and optional ROPE testing for practical significance.
The interesting bit
Most causal libraries treat uncertainty as an afterthought; CausalPy makes it the main event by reporting HDIs and tail probabilities by default. The library also bakes in diagnostics-first design—effect summaries come in both tabular and prose formats, which is the kind of reproducible artifact you actually want to paste into a decision memo.
Key highlights
- Covers ten quasi-experimental methods including staggered DiD, regression kink, and inverse propensity weighting
- Bayesian-first via PyMC with Highest Density Intervals, plus fallback OLS through scikit-learn
- Built-in ROPE analysis and direction testing (e.g., P(effect > 0)) for practical significance
- Outputs publication-quality plots and structured effect summaries meant for direct interpretation
- Includes “AI agent skills” to teach coding assistants how to use the library
Caveats
- Explicitly not for black-box automated causal discovery or weakly identified observational data without a plausible design
- Production workflow features like multi-user governance and pipelines are out of scope
- Zenodo DOI for stable releases is still planned, so citation currently relies on the GitHub repository
Verdict
Worth a look if you run geo-lifts, policy evaluations, or any quasi-experiment where defensible uncertainty quantification matters. Skip it if you are hunting for automated causal discovery in messy observational data or need enterprise pipeline orchestration.
Frequently asked
- What is pymc-labs/CausalPy?
- Bayesian causal inference for quasi-experiments, shipping credible intervals and practical-significance tests where randomized controls don't exist.
- Is CausalPy open source?
- Yes — pymc-labs/CausalPy is open source, released under the Apache-2.0 license.
- What language is CausalPy written in?
- pymc-labs/CausalPy is primarily written in Python.
- How popular is CausalPy?
- pymc-labs/CausalPy has 1.2k stars on GitHub.
- Where can I find CausalPy?
- pymc-labs/CausalPy is on GitHub at https://github.com/pymc-labs/CausalPy.