[Lecture Idea] Difference-in-Differences with a Continuous Treatment (Callaway, Goodman-Bacon & Sant'Anna)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 28/100
Direzione di ricerca
Inizia decidendo quale repository o serie di lezioni debba ospitare il materiale e leggi il paper citato di Callaway, Goodman-Bacon e Sant’Anna insieme alla scaletta proposta. Verifica ContinuousDiD di diff-diff rispetto a contdid su dati simulati fissi, includendo l’adozione scaglionata e la copertura CCK. Il lavoro è completato quando sono stati decisi l’ambito delle lezioni, l’approccio di implementazione, il piano di validazione e la scelta dei dati empirici.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Proposal for a new applied econometrics lecture covering modern difference-in-differences with a continuous treatment (dose), based on:
Callaway, B., Goodman-Bacon, A., & Sant'Anna, P. H. C. (2025). Difference-in-Differences with a Continuous Treatment. American Economic Review (forthcoming). [AEA page](https://www.aeaweb.org/articles?id=10.1257/aer.20240137) · [arXiv:2107.02637](https://arxiv.org/abs/2107.02637)
This is arguably the definitive treatment of continuous-dose DiD and slots naturally into a "modern econometrics" sequence alongside existing causal inference material.
Why this lecture?
- Empirical relevance for trade/macro applications. Most real-world "treatments" in international trade are continuous: tariff changes, import-competition exposure (the ADH China shock), trade-cost reductions, exchange-rate pass-through. The workhorse approach — TWFE regression of an outcome on a continuous exposure measure — is exactly what this paper shows can be misleading.
- Pedagogically rich. The paper cleanly separates (i) identification (ATT-type parameters under parallel trends), (ii) the selection-bias problem when comparing effects across doses (ACRT parameters need stronger assumptions), and (iii) estimation (B-splines, nonparametric sieve methods, multiplier bootstrap for uniform confidence bands). Each piece is implementable from scratch in NumPy/SciPy at lecture scale.
- Fills a gap. QuantEcon has limited coverage of the post-2018 DiD literature (staggered adoption, negative TWFE weights, heterogeneity-robust estimators). This lecture could anchor that area.
Proposed outline
- Motivation — a trade example: regions exposed to a tariff cut at varying intensity. Why "run TWFE on the dose" is the default and why it's fragile.
- Setup and notation — potential outcomes indexed by dose
Y_t(d); timing groupsg; building blocksATT(g, t, d). - Identification — parallel trends identifies ATT(d); comparing across
d(slopes / ACRT) requires "strong" parallel trends. Simulation demonstrating the selection-bias wedge. - What TWFE actually estimates — decompose the TWFE estimand; show negative-weighting pathologies with simulated heterogeneous dose effects.
- Estimation — implement the ATT(d) / ACRT(d) estimators with B-splines (
scipy.interpolate); event-study and dose aggregations; multiplier bootstrap for uniform confidence bands. - Application — replicate (or adapt) the paper's empirical application, or a trade-flavoured alternative (e.g., regional tariff exposure).
- Exercises — vary the dose-effect functional form; compare TWFE vs. the robust estimator; coverage experiments for pointwise vs. uniform bands.
Implementation notes
- Reference implementation is the authors' R package
[contdid](https://bcallaway11.github.io/contdid/)(alpha, GPL-3). - Python ecosystem: the
[diff-diff](https://diff-diff.readthedocs.io/)package (Gerber, 2026) now includes aContinuousDiDestimator implementing CGS — B-spline dose-response curves (ATT(d) / ACRT(d)), overall ATT/ACRT aggregation, multiplier bootstrap (rademacher/mammen/webb weights) plus analytical SEs, and correct handling of the PT vs. strong-PT identification distinction. It sits within a unified scikit-learn-style API covering 13+ DiD estimators validated against R counterparts.- Role in the lecture: build the estimator from first principles (the pedagogical core), then close by cross-checking results against
diff-diffand pointing students to it (andcontdidin R) for production use. This mirrors the QuantEcon pattern of "implement it yourself, then use the library." - Audit task before adoption: verify
diff-diff's continuous module againstcontdidoutput on fixed simulated data, and confirm coverage of staggered adoption for continuous doses (docs emphasize the dose-response core; staggered support unclear) and whether the CCK data-driven estimator is included. Findings feed the companion project issue.
- Role in the lecture: build the estimator from first principles (the pedagogical core), then close by cross-checking results against
- Scope for a lecture-scale implementation: simulated panel data + B-spline dose-response estimation + multiplier bootstrap is very tractable (a few hundred lines). The data-driven sieve method (Chen, Christensen & Kankanala 2025,
npiv) is harder and could be mentioned rather than implemented, or deferred to a follow-up. - License note:
contdidis GPL-3. The lecture should reimplement from the paper's equations rather than translating package source, to keep our standard BSD-3/CC licensing clean. (Checkdiff-diff's license before recommending it in lecture text — likely permissive, but confirm.) - Possible synergy: the estimators here build on the
did/ptetoolsecosystem; if we later cover Callaway & Sant'Anna (2021) staggered DiD,diff-diffalso covers that estimator, so the two lectures could share both from-scratch infrastructure and the same production-library endpoint.
Open questions
- Which repo/series does this belong in?
- Simulated data only, or include an empirical replication (data availability/licensing to check)?
- Implement CCK nonparametric estimator, or B-spline parametric only?
- JAX or NumPy for the bootstrap? (multiplier bootstrap vectorises nicely in either)
- Use
diff-diffas the lecture's validation cross-check and "production use" recommendation, pending the audit above?
References
- Callaway, Goodman-Bacon & Sant'Anna (2025), DiD with a Continuous Treatment, AER forthcoming.
- Chen, Christensen & Kankanala (2025), "Adaptive Estimation and Uniform Confidence Bands for Nonparametric Structural Functions and Elasticities", REStud 92(1).
- Callaway & Sant'Anna (2021), "Difference-in-Differences with Multiple Time Periods", J. Econometrics.
- Goodman-Bacon (2021), "Difference-in-Differences with Variation in Treatment Timing", J. Econometrics.
contdid(R, reference implementation): https://bcallaway11.github.io/contdid/diff-diff(Python): https://diff-diff.readthedocs.io/ —ContinuousDiDmodule: https://diff-diff.readthedocs.io/en/stable/api/continuous_did.html
- Lingua principale
- Python
- Stelle
- 1
- Fork
- 0
- Merge medio
- 1g 3h
- PR unite (30g)
- 17
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di QuantEcon/lectures
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
drift
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
question
Difficoltà 4/5 1-2 giorni Idoneità per principianti 44/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
QuantEcon/lectures#40 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di QuantEcon/lectures
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Project-N-E-K-O/N.E.K.O#3670 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
type:docs
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
jejjohnson/xtremax#123 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
microsoft/agent-framework#10218 ·
I maintainer di solito rispondono entro 1 giorno
-
fidelity
Difficoltà 2/5 Mezza giornata Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno