pymc-labs/CausalPy
A Python package for causal inference in quasi-experimental settings
What it solves
CausalPy provides a framework for estimating causal effects in quasi-experimental designs where randomized controlled trials are not possible. It addresses the need for research-grade, reproducible causal inference workflows that move beyond simple point estimates to include full uncertainty quantification.
How it works
The library implements a variety of quasi-experimental methods (such as Difference-in-Differences, Synthetic Control, and Regression Discontinuity) using either Bayesian estimation via PyMC or traditional Ordinary Least Squares (OLS) via scikit-learn. It focuses on a "diagnostics-first" approach, providing tools to calculate Highest Density Intervals (HDI) for Bayesian models and the Region of Practical Equivalence (ROPE) to determine if an effect is practically significant.
Who it’s for
It is designed for researchers and data scientists who have a plausible quasi-experimental design (e.g., policy changes, threshold rules, or staggered rollouts) and require rigorous, uncertainty-aware estimates for high-stakes decision-making.
Highlights
- Diverse Method Palette: Supports Synthetic Control, Geographical Lift, ANCOVA, Difference-in-Differences (including staggered), Interrupted Time Series, Regression Discontinuity/Kink, Instrumental Variables, and Inverse Propensity Score Weighting.
- Bayesian-First Approach: Leverages PyMC for full uncertainty quantification and posterior estimates.
- Decision-Ready Outputs: Generates effect summaries with credible intervals and publication-quality plots.
- Practical Significance Testing: Includes ROPE analysis to assess if effects exceed meaningful thresholds.
Related
- Project
- Project
- Project
- Project
- Project