bernardodionisi/differences
difference-in-differences in Python
Featured achievements
The project's latest awards
#1 Repository of the month
#1 Repository of the month
#1 Repository of the month

difference-in-differences estimation and inference for Python
For the following use cases
- Balanced panels, unbalanced panels & repeated cross-section
- Two + Multiple time periods
- Fixed + Staggered treatment timing
- Binary + Multi-Valued treatment
- Heterogeneous treatment effects & triple difference
- Parallelized estimation & multiplier bootstrap (joblib, via
n_jobs)
see the Documentation for more details.
Installing
The latest release can be installed using pip
pip install differences
requires Python >= 3.10
Quick Start
ATTgt
the ATTgt class implements the estimation procedures suggested by Callaway and Sant'Anna (2021) , Sant'Anna and Zhao (2020) and the multi-valued treatment case discussed in Callaway, Goodman-Bacon & Sant'Anna (2021)
import differences
df = differences.generate_data() # requires the [all] extra: pip install differences[all]
att_gt = differences.ATTgt(data=df, cohort_column='cohort')
att_gt.fit(formula='y', n_jobs=-1)
att_gt.aggregate('event')
differences ATTgt was inspired by
Similar Projects
Discover other similar projects and AI models.
Difference-in-Differences causal inference in Python. Callaway-Sant'Anna, Synthetic DiD, Honest DiD, event studies. sklearn-like API, validated against R.
Stata-aligned econometrics for Python, with field-level validation across the documented support surface.
StatsPAI is an Agent-native Python library for causal inference and applied econometrics — unified API, broad cross-method coverage, structured result objects, machine-readable schemas, Skills, an MCP server, and R/Stata parity validation.
A Python package for causal inference using Synthetic Controls
Evidence-first AI workflow for economic and financial research: literature → identification → data → econometrics → verifiable LaTeX. 43 data sources, 58 method modules, 18 AI skills, 30 journal templates.
ALICE (Automated Learning and Intelligence for Causation and Economics) is a Microsoft Research project aimed at applying Artificial Intelligence concepts to economic decision making. One of its goals is to build a toolkit that combines state-of-the-art machine learning techniques with econometrics in order to bring automation to complex causal inference problems. To date, the ALICE Python SDK (econml) implements orthogonal machine learning algorithms such as the double machine learning work of Chernozhukov et al. This toolkit is designed to measure the causal effect of some treatment variable(s) t on an outcome variable y, controlling for a set of features x.
Causal Inference for the Brave and True. A light-hearted yet rigorous approach to learning about impact estimation and causality.
A ready-to-fork Claude Code template for academic research — papers, data analysis (R, Stata, Python), slides and teaching — with multi-agent review, enforced quality gates and replication protocols. Codex and Antigravity can use it too.