R packages

Packages are sorted in alphabetical order by name. If the installation says remotes::install_github<name>, then you first need to install the remotes package with install.packages("remotes"). Please note that some installation paths have been split across lines to preserve table formatting in Markdown. Make sure they are in the same line when you copy them across to your own R console, for example, remotes::install_github("asheshrambachan/HonestDiD"). Package documentation is identified in the Website column.

Name Installation Website Package by Reference paper
bacondecomp install.packages ("bacondecomp") Link Evan Flack
Ed Jee
Andrew Goodman-Bacon (2021). Difference-in-differences with variation in treatment timing. Journal of Econometrics.
did install.packages("did") Link 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.
did2s install.packages("did2s") Link 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.
didimputation install.packages ("didimputation") Link Kyle Butts Kirill Borusyak , Xavier Jaravel , Jann Spiess (2021). Revisiting Event Study Designs: Robust and Efficient Estimation.
DIDmultiplegt remotes::install_github ("shuo-zhang-ucsb/did_multiplegt) Link Shuo Zhang Clément de Chaisemartin, Xavier D’Haultfoeuille (2020). Two-Way Fixed Effects Estimators with Heterogeneous Treatment Effects. American Economic Review.
DRDID install.packages("DRDID") Link Pedro H.C. Sant’Anna
Jun Zhao
Pedro H.C. Sant’Anna , Jun Zhao (2020). Doubly robust difference-in-differences estimators, Journal of Econometrics.
etwfe install.packages("etwfe") Link Grant McDermott Jeffrey Wooldridge (2021). Two-Way Fixed Effects, the Two-Way Mundlak Regression, and Difference-in-Differences Estimators.. Working Paper.
fixest with sunab() function install.packages("fixest") Link Laurent Bergé Liyang Sun, Sarah Abraham (2020). Estimating dynamic treatment effects in event studies with heterogeneous treatment effects. Journal of Econometrics.
gsynth install.packages("gsynth") Link Yiqing Xu
Licheng Liu
Yiqing Xu (2017). Generalized Synthetic Control Method: Causal Inference with Interactive Fixed Effects Models. Political Analysis.
HonestDiD remotes::install_github ("asheshrambachan/HonestDiD") Link Ashesh Rambachan
Jonathan Roth
Ashesh Rambachan , Jonathan Roth (2021). An Honest Approach to Parallel Trends.
staggered install.packages("staggered") Link Jonathan Roth
Pedro H.C. Sant’Anna
Jonathan Roth , Pedro H.C. Sant’Anna (2021). Efficient Estimation for Staggered Rollout Designs.
synthdid remotes::install_github ("synth-inference/synthdid") Link David Hirshberg
Stefan Wager
Dmitry Arkhangelsky
Susan Athey
Guido Imbens
Dmitry Arkhangelsky , Susan Athey , David Hirshberg, Guido Imbens, Stefan Wager (2021). Synthetic Difference-in-Differences. American Economic Review.
pretrends remotes::install_github ("jonathandroth/pretrends") Link Jonathan Roth Jonathan Roth (2021). Pre-test with Caution: Event-study Estimates After Testing for Parallel Trends.
TwoWayFEWeights install.packages("TwoWayFEWeights") Link Shuo Zhang Clément de Chaisemartin, Xavier D’Haultfoeuille (2021). Two-Way Fixed Effects Estimators with Heterogeneous Treatment Effects.

How to use R packages?

Florian M. Hollenbach. Comparing Staggered DiD.

Grant McDermott maintains the R code section on this website.

Brantly Callaway and Pedro H.C. Sant’Anna have a bunch of guides for csdid in R.

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

Olivia Healy has a presentation that dicusses the DiD literature and also goes over the cs-did implementation in R.

A big thanks to Taylor Wright for initially helping with identifying the R packages!