Here we implement the Two-way fixed effects model and an events study type approach. Note that in the example here we do not have any staggered policy implementation and we assume that there are no heterogenous policy effects (for units) but do allow the policy to have time-varying effects (in the event study approach).
Implementation is in R / RStudio
Code available from:
https://github.com/datasquad/RforQM/blob/master/Regression/DC3.R
Data file available from:
https://github.com/datasquad/RforQM/blob/master/data/did_4.dta