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
install.packages("DIDmultiplegt")
Link
Shuo Zhang
Clément de Chaisemartin , Xavier D’Haultfoeuille (2020). Two-Way Fixed Effects Estimators with Heterogeneous Treatment Effects . American Economic Review.
DIDmultiplegtDYN
install.packages("DIDmultiplegtDYN")
Link
Clément de Chaisemartin Diego Ciccia Xavier D’Haultfoeuille Felix Knau Mélitine Malézieux Doulo Sow
Clément de Chaisemartin , Xavier D’Haultfoeuille (2024a). Difference-in-Differences Estimators of Intertemporal Treatment Effects , Review of Economics and Statistics. Clément de Chaisemartin , Diego Ciccia , Xavier D’Haultfoeuille , Felix Knau , Mélitine Malézieux , Doulo Sow (2024c) Event-Study Estimators and Variance Estimators Computed by the did_multiplegt_dyn Command
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
Clément de Chaisemartin Diego Ciccia Xavier D’Haultfoeuille Felix Knau Doulo Sow Shuo Zhang
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 .
YatchewTest
install.packages("YatchewTest")
Link
Clément de Chaisemartin Diego Ciccia Xavier D’Haultfoeuille Felix Knau Doulo Sow
Yatchew (1997) , de Chaisemartin and D’Haultfoeuille (2024b)
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!