Tutorials#
Every tutorial is a runnable Jupyter notebook. If you are new to diff-diff, start with Basic DiD; if you are measuring a business intervention, start with the Business Applications track.
Business Applications#
Practitioner walkthroughs built around marketing and policy scenarios.
Measure campaign impact on brand awareness with complex survey data and staggered rollouts.
Measure lift from a campaign that ran in a subset of geographic markets using Synthetic DiD.
Analyze on/off pulse campaigns with the de Chaisemartin-D’Haultfoeuille estimator for reversible treatments.
Estimate per-dollar lift when every market receives a different spend intensity.
Run the pre-test diagnostics on the brand-campaign panel before trusting the estimate.
Heterogeneous-adoption DiD on a BRFSS-shape survey rollout with design weights.
Handle treatment that spills over onto nearby control units in a TVA-style worked example.
Survey calibration for causal DiD when who answers changes over time.
See which quantiles moved when the average hides the action, with Changes-in-Changes.
Turn a geo spend-boost experiment into a PyMC-Marketing lift test and watch the MMM’s ROI posterior correct - executed end-to-end.
Export a geo-holdout launch as Meridian’s ROI prior and calibration mask, then fit the real model - executed end-to-end.
Fundamentals#
The core DiD toolkit, from your first 2x2 design to real published datasets.
Your first 2x2 DiD: column-name and formula interfaces, covariates, fixed effects, and robust inference.
Handle staggered treatment adoption with modern heterogeneity-robust estimators.
Combine DiD with synthetic-control weighting (Arkhangelsky et al. 2021).
Add a second comparison dimension when treatment requires satisfying two criteria.
Classic datasets end to end: Card & Krueger minimum wage, Castle Doctrine, and more.
Advanced Methods#
Modern estimators for designs the basic toolkit cannot handle.
Triply robust panel estimator with factor-model adjustment (Athey et al. 2025).
The efficient imputation estimator of Borusyak, Jaravel & Spiess (2024).
Gardner (2022) two-stage residualized estimation for staggered designs.
Stacked event studies with corrective weights (Wing, Freedman & Hollingsworth 2024).
Dose-response treatment effects with continuous treatment intensity.
Semiparametrically efficient ATT estimation (Chen, Sant’Anna & Xie 2025).
DiD on stratified survey microdata with design-based inference.
Wooldridge’s extended two-way fixed effects via pooled OLS.
Single-treated-unit policy evaluation with two routes to inference.
Sharp and fuzzy RD from plot to estimate, when a naive cutoff comparison overstates the effect fivefold.
Turn the panel into a cross-section, get exact small-sample inference, and replicate the Prop 99 and Walmart applications.
Cross-fitted ML nuisances for nonlinear confounding - watch a misspecified linear model fail where the sieve recovers the truth.
Covariates that treatment can change: the include-at-t bias, Approach 1 via base-period covariates, the DMLDiD bad-control lane, and reading the ATT_X pre-test.
Study Design#
Assess identifying assumptions and size your study before committing to it.
Assess pre-treatment evidence relevant to parallel trends, check test power, and run the full diagnostic suite.
Robust inference under parallel-trends violations (Rambachan & Roth 2023).
Compute minimum detectable effects and sample sizes before running the study.
Check whether your pre-trends test can actually detect violations (Roth 2022).
Staggered rollout or a simple 2x2? A power-analysis decision guide.