/DiD

Keeping track of what is going on with the latest DiD innovations.

MIT LicenseMIT

Last updated: 14 September 2021

Notes

This repository tracks the recent developments in the Difference-in-Difference (DiD) literature. Currently, it is just a dump of my bookmarks from different websites including Twitter, GitHub, YouTube etc. This will be sorted out over time as the literature converges to some consensus. But this might still take a while.

This is a working document. If you want to report errors or contribute, just open an issue, start a discussion, or e-mail at asjadnaqvi@gmail.com. Since paths and links are also subject to change, please report them to keep this repository as up-to-date as possible.

The website will slowly port to a dedciated website where I want to add some Stata code. Again this is to help me navigate the literature and find the commands easily that are currently split across several dofiles.

Stata packages

Some package paths have been split across lines but adding spaces to keep table formatting intact. Just make sure they are in one line with spaces removed when copying them in Stata. To install packages from GitHub, get the github package: net install github, from("https://haghish.github.io/github/").

Name Installation Package by Reference paper
bacondecomp ssc install bacondecomp, replace

or

net install ddtiming, from (https://tgoldring.com/code/)
Andrew Goodman-Bacon

Thomas Goldring

Austin Nichols
Andrew Goodman-Bacon (2021). Difference-in-differences with variation in treatment timing. Journal of Econometrics
eventstudyinteract ssc install eventstudyinteract, replace Liyang Sun Liyang Sun, Sarah Abraham (2020). Estimating dynamic treatment effects in event studies with heterogeneous treatment effects. Journal of Econometrics.
did_multiplegt ssc install did_multiplegt, replace Clément de Chaisemartin

Xavier D'Haultfoeuille
Clément de Chaisemartin, Xavier D'Haultfoeuille (2020). Two-Way Fixed Effects Estimators with Heterogeneous Treatment Effects. American Economic Review.

Clément de Chaisemartin, Xavier D'Haultfoeuille (2021). Two-way fixed effects regressions with several treatments.

Clément de Chaisemartin, Xavier D'Haultfoeuille (2021). Difference-in-Differences Estimators of Inter-temporal Treatment Effects.
did_imputation ssc install did_imputation, replace Kirill Borusyak

Xavier Jaravel

Jann Spiess
Kirill Borusyak , Xavier Jaravel , Jann Spiess (2021). Revisiting Event Study Designs: Robust and Efficient Estimation.
drdid ssc install drdid, replace Fernando Rios-Avila

Pedro H.C. Sant'Anna

Asjad Naqvi
Pedro H.C. Sant'Anna , Jun Zhao (2020). Doubly robust difference-in-differences estimators, Journal of Econometrics.
csdid ssc install csdid, replace Fernando Rios-Avila

Pedro H.C. Sant'Anna
Brantly Callaway, Pedro H.C. Sant'Anna (2020). Difference-in-Differences with multiple time periods, Journal of Econometrics.
flexpaneldid ssc install flexpaneldid, replace Eva Dettmann

Alexander Giebler

Antje Weyh
Eva Dettmann, Alexander Giebler, Antje Weyh (2020). Flexpaneldid: A Stata Toolbox for Causal Analysis with Varying Treatment Time and Duration. IWH Discussion Papers No. 3/2020
xtevent ssc install xtevent, replace Simon Freyaldenhoven

Christian Hansen

Jorge Perez Perez

Jesse M. Shapiro
Simon Freyaldenhoven, Christian Hansen, Jesse M. Shapiro (2019). Pre-event Trends in the Panel Event-Study Design. American Economic Review.
did2s ssc install did2s, replace Kyle Butts John Gardner (2021). Two-stage differences in differences.
stackedev github install joshbleiberg/stackedev Joshua Bleiberg Doruk Cengiz , Arindrajit Dube , Attila Lindner, Ben Zipperer (2019). The effect of minimum wages on low-wage jobs. The Quarterly Journal of Economics.
eventdd ssc install eventdd, replace Damian Clarke

Kathya Tapia
Damian Clarke, Kathya Tapia (2020). Implementing the Panel Event Study.
staggered_stata github install jonathandroth/staggered_stata Jonathan Roth Jonathan Roth , Pedro H.C. Sant'Anna (2021). Efficient Estimation for Staggered Rollout Designs

How to use Stata packages?

For individual packages, check their helpfiles for example code.

For using and plotting multiple DiD packages in Stata, the event_plot command (ssc install event_plot, replace) by Kirill Borusyak is highly recommended. It estimates and combines results from five different estimators. Example of how to do event study plots using different packages is given in the five_estimators_example.do dofile on GitHub.

The event_plot usage example has been extended twice:

Scott Cunningham has sample dofiles as part of the CodeChella DiD event.

R packages

Packages installation paths have been split across lines to preverse table formatting in Markdown.

Name Installation Package by Reference paper
bacondecomp install.packages ("bacondecomp") Evan Flack

Ed Jee
Andrew Goodman-Bacon (2021). Difference-in-differences with variation in treatment timing. Journal of Econometrics.
fixest with sunab() function install.packages ("fixest") Laurent Bergé Liyang Sun, Sarah Abraham (2020). Estimating dynamic treatment effects in event studies with heterogeneous treatment effects. Journal of Econometrics.
TwoWayFEWeights install.packages ("TwoWayFEWeights") Shuo Zhang Clément de Chaisemartin, Xavier D'Haultfoeuille (2021). Two-Way Fixed Effects Estimators with Heterogeneous Treatment Effects.
DIDmultiplegt [not as recent as Stata version] install.packages ("DIDmultiplegt") Shuo Zhang Clément de Chaisemartin, Xavier D'Haultfoeuille (2020). Two-Way Fixed Effects Estimators with Heterogeneous Treatment Effects. American Economic Review.
drdid devtools::install_github ("pedrohcgs/DRDID") Pedro H.C. Sant'Anna

Jun Zhao
Pedro H.C. Sant'Anna , Jun Zhao (2020). Doubly robust difference-in-differences estimators, Journal of Econometrics.
did install.packages("did") Pedro H.C. Sant'Anna

Brantly Callaway
Brantly Callaway, Pedro H.C. Sant'Anna (2020). Difference-in-Differences with multiple time periods, Journal of Econometrics.
staggered devtools::install_github ("jonathandroth/staggered") Jonathan Roth

Pedro H.C. Sant'Anna
Jonathan Roth , Pedro H.C. Sant'Anna (2021). Efficient Estimation for Staggered Rollout Designs
didimputation devtools::install_github ("kylebutts/didimputation") Kyle Butts Kirill Borusyak , Xavier Jaravel , Jann Spiess (2021). Revisiting Event Study Designs: Robust and Efficient Estimation.
did2s devtools::install_github ("kylebutts/did2s") Kyle Butts John Gardner (2021). Two-stage differences in differences.

Kirill Borusyak , Xavier Jaravel , Jann Spiess (2021). Revisiting Event Study Designs: Robust and Efficient Estimation

Liyang Sun, Sarah Abraham (2020). Estimating dynamic treatment effects in event studies with heterogeneous treatment effects. Journal of Econometrics.

Brantly Callaway, Pedro H.C. Sant'Anna (2020). Difference-in-Differences with multiple time periods, Journal of Econometrics.

Jonathan Roth , Pedro H.C. Sant'Anna (2021). Efficient Estimation for Staggered Rollout Designs.
HonestDiD remotes::install_github ("asheshrambachan/HonestDiD") Ashesh Rambachan

Jonathan Roth
Ashesh Rambachan , Jonathan Roth (2021). An Honest Approach to Parallel Trends.

How to use R packages?

Kyle Butts has an R event study package that plots multiple estimators.

Julia packages

This is still being updated. See links below for details. There is also a Julia DiffinDiff group on GitHub which contains various packages.

Name Installation Package by Reference paper
InteractionWeightedDIDs.jl GitHub
SynthControl.jl GitHub

Literature

Papers

Papers are in alphabetical order by last name. Papers without journals are pre-prints. Please click on paper links for details. SORTABLE TABLE TO BE ADDED.

Dmitry Arkhangelsky, Susan Athey, David A. Hirshberg, Guido W. Imbens, Stefan Wager (2021). Synthetic Difference in Differences. American Economic Review.

Dmitry Arkhangelsky , Guido Imbens, Lihua Lei , Xiaoman Luo (2021). Double-Robust Two-Way-Fixed-Effects Regression For Panel Data.

Susan Athey, Guido Imbens (2006). Identification and inference in nonlinear difference-indifferences models. Econometrica.

Andrew Baker, David F. Larcker, Charles C. Y. Wang (2021). How Much Should We Trust Staggered Difference-In-Differences Estimates?

Kirill Borusyak , Xavier Jaravel , Jann Spiess (2021). Revisiting Event Study Designs: Robust and Efficient Estimation.

Brantly Callaway, Andrew Goodman-Bacon, Pedro H.C. Sant'Anna (2021). Difference-in-Differences with a Continuous Treatment.

Brantly Callaway, Pedro H.C. Sant'Anna (2020). Difference-in-Differences with multiple time periods, Journal of Econometrics.

Clément de Chaisemartin, Xavier D'Haultfoeuille (2018). Fuzzy differences-in-differences. The Review of Economic Studies.

Clément de Chaisemartin, Xavier D'Haultfoeuille (2020). Two-Way Fixed Effects Estimators with Heterogeneous Treatment Effects. American Economic Review.

Clément de Chaisemartin, Xavier D'Haultfoeuille (2021). Two-way fixed effects regressions with several treatments.

Clément de Chaisemartin, Xavier D'Haultfoeuille (2021). Difference-in-Differences Estimators of Inter-temporal Treatment Effects.

Xavier D’Haultfoeuille, Stefan Hoderlein, Yuya Sasaki (2013). Nonlinear difference-indifferences in repeated cross sections with continuous treatments.

Xavier D’Haultfoeuille, Stefan Hoderlein, Yuya Sasaki (2021). Nonparametric Difference-in-Differences in Repeated Cross-Sections with Continuous Treatments.

Bruno Ferman , Cristine Pinto (2021). Synthetic Controls with Imperfect Pre-Treatment Fit. Quantitative Economics.

Simon Freyaldenhoven, Christian Hansen, Jesse M. Shapiro (2019). Pre-event Trends in the Panel Event-Study Design. American Economic Review.

Hans Fricke (2017). Identification based on difference-in-differences approaches with multiple treatments. Oxford Bulletin of Economics and Statistics.

Pamela Jakiela (2021). Simple Diagnostics for Two-Way Fixed Effects

John Gardner (2021). Two-stage differences in differences.

Andrew Goodman-Bacon (2021). Difference-in-differences with variation in treatment timing. Journal of Econometrics.

Jonathan Roth (2021). Pre-test with Caution: Event-study Estimates After Testing for Parallel Trends.

Jonathan Roth , Pedro H.C. Sant'Anna (2021). Efficient Estimation for Staggered Rollout Designs.

Pedro H.C. Sant'Anna , Jun Zhao (2020). Doubly robust difference-in-differences estimators, Journal of Econometrics.

Liyang Sun, Sarah Abraham (2020). Estimating dynamic treatment effects in event studies with heterogeneous treatment effects. Journal of Econometrics.

Books

The books below are the ones that discuss the new DiD literature. There are of course many other great books!

Scott Cunningham (2020). Causal Inference: The Mix Tape.

Nick Huntington-Klein (2021). The Effect.

DiD knowledge curation

Here are people who are actively involved in curating information on the latest DiD developments. This includes blogs, lecture series, tweets.

Events and Videos

Scott Cunningham : CodeChella the ultimate DiD event Workshop 1: Friday July 16th, 2021 and Workshop 2: Friday July 23, 2021 which will be live on Twitch. The videos from the workshop are now up on YouTube.

Chloe East organizes an online DiD reading group.

Taylor J. Wright organizes an online DiD reading group. The lectures can be viewed on YouTube. Here is a playlist in the order they appear:

Blogs & notes

Scott Cunningham : Scott's Substack is the goto place for an easy-to-digest explanation of the latest metric-heavy DiD papers.

An Introduction to DiD with Multiple Time Periods by Brantly Callaway and Pedro H.C. Sant'Anna .

Jeffrey Wooldridge has made several notes on DiD which are shared on his Dropbox including Stata dofiles.

Fernando Rios-Avila has a great explainer for the Callaway and Sant'Anna (2020) CS-DID logic on his blog.

Christine Cai has a working document which lists recent papers using different methods including DiDs.

Andrew C. Baker has notes on Difference-in-Differences Methodology with supporting material on GitHub.

Paul Goldsmith-Pinkham has a brilliant set of lectures on empirical methods including DiD on GitHub. These are also supplemented by YouTube videos.

Interactive dashboards

These (related) interactive R-Shiny dashboards showcase how TWFE models give wrong estimates.

Kyle Butts : https://kyle-butts.shinyapps.io/did_twfe/

Hans Henrik Sievertsen : https://hhsievertsen.shinyapps.io/kylebutts_did_eventstudy/

Tweets

Some interesting Twitter threads in no particular sequence. In order to render these properly, you need to view them on the Jekyll website.


Hi @pedrohcgs I have a question about @jmwooldridge two way mundlak paper, "As the number of pre-treatment periods increases, POLS will become even more efficient compared with CS (2021)" Why your estimation is more less efficient? I'm a few confused, sorry
All the best. Thks

— Oscar Andres Martinez (@oscand_martinez) August 23, 2021
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

The diff-in-diff literature is plagued with the notion that more controls are always better (as long as the treatment effect has 2 stars). Someone please write a version of this @yudapearl paper aimed at the assumptions & examples of DiD. #EconTwitter https://t.co/JfxQHGlxgw

— Arthur Lewbel (@lewbel) July 29, 2021
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

🚨Hello #EconTwitter! I am very happy that my paper with Brantly Callaway, "Difference-in-Differences with multiple time periods", is now forthcoming at the Journal of Econometrics. https://t.co/zoNxNY9ugq

What are the main take aways? I will ask my daughter to help me out.

1/n pic.twitter.com/DNj3Cpxxlu

— Pedro H. C. Sant'Anna (@pedrohcgs) December 18, 2020
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

I finally got my TWFE/Mundlak/DID paper in good enough shape to make it an official working paper. I'll put it in other places but it's currently here:https://t.co/D4iQETUSlX

Also, the Stata stuff is still with the Dropbox link:https://t.co/q1AnkhEF97#metricstotheface

— Jeffrey Wooldridge (@jmwooldridge) August 17, 2021
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

In preparing a DID course, I discovered some other neat stuff. When you impose PT and allow flexible interactions with covariates the way I do, the POLS estimator is numerically identical to the comparable imputation estimator in Borusyak, Jaravel, Spiess (2021). @borusyak

— Jeffrey Wooldridge (@jmwooldridge) August 17, 2021
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

More DID stuff, re: parallel trends. If you have two pre-treatment periods there are various equiv ways to test for pre-trends. Here are three (no controls):
1. Regress cy2 = y2 - y1 on 1, d using t = 2; obtain t test on d.
This is a standard placebo test.#metricstotheface

— Jeffrey Wooldridge (@jmwooldridge) August 18, 2021
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

In my career I have spent a lot of time assessing parallel trends in dif-in-dif models and visualizing those; this one is on top of my current list... and developing this was a team effort!

Show placebo estimates for a whole set of placebo dates, each w dynamic treatment effects https://t.co/lxSfekefkY

— Arindrajit Dube (@arindube) August 20, 2021
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

I spent this past week catching up with the DiD literature. Here is my list🧵:
1. Read (if you haven't) Andrew Goodman-Bacon's "Difference-in-Differences with Variation in Treatment Timing." The paper that started all for me (there are others before).Link: https://t.co/GBFjBnHDcj

— Jesús Villero (@jotavillero) May 16, 2021
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

Navigating the DiD revolution from one applied researcher's perspective.

A LONG 🧵 on what I've learned & what I'm still trying to figure out. Advice/insights welcome!

My @michaelpollan 🥦🍅🥕🫑 inspired TL;DR take:

"Apply DiD in context, not every 2x2, mostly event studies" pic.twitter.com/CWmwyo1Btp

— Matthew A. Kraft (@MatthewAKraft) June 24, 2021
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

I've been catching up on staggered diff-in-diff/two-way fixed effects recently. Simulating helped me see how bad TWFE performs with dynamic treatment effects (see those pre-trends). I also tried implementing Sun & Abraham (2020)'s interaction-weighted estimator in Stata pic.twitter.com/FQBCQi0m7d

— Shan Huang (@ShanHuang_ec) June 16, 2020
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

The diff-in-diff literature is plagued with the notion that more controls are always better (as long as the treatment effect has 2 stars). Someone please write a version of this @yudapearl paper aimed at the assumptions & examples of DiD. #EconTwitter https://t.co/JfxQHGlxgw

— Arthur Lewbel (@lewbel) July 29, 2021
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

This is a really interesting discussion of using potential outcomes to define causal effects. Not sure I agree with the critiques, but they're thought-provoking

key quote: "I don’t like the idea of types defined by something that happens in the future.."https://t.co/AWRK9Qgj4W pic.twitter.com/a1J8pDxfXK

— Peter Hull (@instrumenthull) July 26, 2021
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

As I was re-reading this paper recently, I wanted to draw attention to the fact that this paper by Gardner (2021) derives (in appendix B)( the event-specific weights for each event in a "stacked regression" used in Cengiz et al (2019).

1/https://t.co/ucvjcNtq3Q pic.twitter.com/drVnoE1xHb

— Arindrajit Dube (@arindube) July 21, 2021
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>