Dear Statalists,
I try to visually evaluate pre-treatment trends using a staggered diff-in-diff model. Basically, I want to plot the coefficient estimates for treatment effects for each time period both before and after treatment period 0, as well as the confidence intervals of the estimates. My data looks like this:
For the DiD regression I used the following code:
Is there a difference between calculating the interaction term beforehand and then simply including the newly calculated variable (Post * Treat) into the model?
Now I would like to assess the pretreatment trends. So far, I used the following code:
This does so far not result in a usable plot and takes quite some time to calculate. Is this the correct approach?
I try to visually evaluate pre-treatment trends using a staggered diff-in-diff model. Basically, I want to plot the coefficient estimates for treatment effects for each time period both before and after treatment period 0, as well as the confidence intervals of the estimates. My data looks like this:
DV | Company | Quarter | Post | Treat | Relative_Treat | Relative_Treat_noNegative |
3 | A | 190 | 0 | 1 | -1 | 1 |
4 | A | 191 | 0 | 1 | 0 | 2 |
2 | A | 192 | 1 | 1 | 1 | 3 |
4 | A | 193 | 1 | 1 | 2 | 4 |
5 | A | 194 | 1 | 1 | 3 | 5 |
2 | B | 190 | 0 | 0 | nan | nan |
4 | B | 191 | 0 | 0 | nan | nan |
1 | B | 192 | 0 | 0 | nan | nan |
3 | B | 193 | 0 | 0 | nan | nan |
4 | C | 190 | 0 | 1 | -2 | 0 |
5 | C | 191 | 0 | 1 | -1 | 1 |
6 | C | 192 | 0 | 1 | 0 | 2 |
1 | C | 193 | 1 | 1 | 1 | 3 |
3 | C | 194 | 1 | 1 | 2 | 4 |
Code:
xtset Company Quarter xtreg DV i.Post#i.Treat i.Quarter, fe
Now I would like to assess the pretreatment trends. So far, I used the following code:
Code:
xtset Company Quarter xtreg DV i.Quarter##i.Relative_Treat_noNegative i.Quarter, fe margins Quarter#Relative_Treat marginsplot
Comment