Hello!
I'm conducting a parallel trend test for staggered DiD, this is the code I use
The code has two parts, first create the relative year dummies, d_3 d_2 d_1 d0 d1 d2, the first 3 are 3 or more, 2, and 1 year(s) before the event year, and the last 3 are the event year and 1, 2 or more year(s) after the event year. Then I regress them with y, controls, and firm and year fixed effects.
What I'm confused about is that I have to drop a year (such as d0, or some other year) to be able to do the regression. Dropping different years will generate different results. If I put all the year dummies, one of them will be omitted.
I find some papers regress all the year dummies in the same regression, so I suppose this is possible. How can I achieve something like this? Thanks!
I'm conducting a parallel trend test for staggered DiD, this is the code I use
Code:
xtset firm year gen distance = year - eventyear replace distance = -3 if distance < -3 replace distance = 2 if distance > 2 forvalues i = -3(1)2 { gen `=strtoname("d`i'")' = (distance == `i') } drop d0 xtreg y d_3-d2 i.year controls ,fe vce(cluster firm)
What I'm confused about is that I have to drop a year (such as d0, or some other year) to be able to do the regression. Dropping different years will generate different results. If I put all the year dummies, one of them will be omitted.
Code:
if d0 is dropped | Robust y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- d_3 | .5068799 .498632 1.02 0.310 -.4719777 1.485738 d_2 | .152638 .2520139 0.61 0.545 -.3420871 .6473631 d_1 | .0003963 .1238065 0.00 0.997 -.2426466 .2434391 d1 | -.2798155 .1182116 -2.37 0.018 -.511875 -.0477559 d2 | -.3843642 .1621353 -2.37 0.018 -.7026497 -.0660787 if d_3 is dropped Robust y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- d_2 | -.3542419 .5307144 -0.67 0.505 -1.39608 .6875962 d_1 | -.5064837 .5103356 -0.99 0.321 -1.508316 .4953491 d0 | -.5068799 .498632 -1.02 0.310 -1.485738 .4719777 d1 | -.7866954 .5150054 -1.53 0.127 -1.797695 .2243047 d2 | -.8912441 .5520619 -1.61 0.107 -1.974989 .1925009 if put all 6 dummies in one regression Robust y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- d_3 | .8912441 .5520619 1.61 0.107 -.1925009 1.974989 d_2 | .5370022 .3235859 1.66 0.097 -.0982248 1.172229 d_1 | .3847605 .2219903 1.73 0.083 -.0510257 .8205467 d0 | .3843642 .1621353 2.37 0.018 .0660787 .7026497 d1 | .1045487 .1402132 0.75 0.456 -.1707018 .3797992 d2 | 0 (omitted)