RepositoryPython
bernardodionisi

bernardodionisi/differences

difference-in-differences in Python

116stars
25forks
8issues
0views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: panel-data

#1 Repository of the month

1
TINIX TRENDING·Topic: causal-inference

#1 Repository of the month

1
TINIX TRENDING·Topic: difference-in-differences

#1 Repository of the month

drawing

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

  • Callaway & Sant'Anna's did
  • Sant'Anna and Zhao's DRDID

Similar Projects

Discover other similar projects and AI models.

RepositoryPython
igerber/diff-diff

Difference-in-Differences causal inference in Python. Callaway-Sant'Anna, Synthetic DiD, Honest DiD, event studies. sklearn-like API, validated against R.

417
Dec 1, 2026
RepositoryPython
ZhenHaoFu810/StataFlow

Stata-aligned econometrics for Python, with field-level validation across the documented support surface.

171
Oct 9, 2026
RepositoryPython
brycewang-stanford/StatsPAI

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.

392
Nov 30, 2026
RepositoryPython
DoubleML/doubleml-for-py

DoubleML - Double Machine Learning in Python

807
Dec 1, 2026
RepositoryPython
OscarEngelbrektson/SyntheticControlMethods

A Python package for causal inference using Synthetic Controls

197
Jan 25, 2024
RepositoryPython
csmar432/finai-research

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.

111
Nov 23, 2026
RepositoryJupyter Notebook
py-why/EconML

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.

4.9k
Nov 23, 2026
RepositoryJupyter Notebook
matheusfacure/python-causality-handbook

Causal Inference for the Brave and True. A light-hearted yet rigorous approach to learning about impact estimation and causality.

3.5k
Oct 6, 2026
RepositoryHTML
pedrohcgs/claude-code-my-workflow

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.

1.8k
Nov 7, 2026