I've searched quite a while for the answer and still have no clue how I would go about setting up this regression in R.
I have estimated a difference-in-difference treatment effect, simply
y ~ treatment*after. I have panel data for 5 years pre-treatment and 5 years post-treatment. Now I additionally would like to estimate yearly treatment effects for all pre- and post-treatment years just as Atkin, Faber and Navarro (2016) did it with monthly data in their paper. They define their regression as follows:
In my data-frame
did, the treatment happens after 5 years and for simplicity I want to normalize the coefficient on year 5 to zero. What I tried so far is to create an indicator variable (dummy) for each year 1 to 10, and then create a new data matrix
did2 including these year dummies:
dy1 <- as.numeric(did$t==1) dy1m <- matrix(dy1, ncol=1, nrow=5000) dy2 <- as.numeric(did$t==2) ... ... did2 <- cbind(did, dy1m, ... , dy10m)
Then, I did the following regression (leaving out fixed effects, clustered errors, etc. for now):
lm(y ~ dy1m + ... + dy10m -1, data = did)
The resulting coefficients do not make sense at all. The problem is that I do not even fully understand what this regression model should look like in my case (when we take the model in Atkin, Faber and Navarro (2016) as an example).
How do I program this model?