Hi all,
I was trying to wrap my head around running event studies in Stata, so I made some fake data (code, data, regression output below). My issue is that I expect to be getting coefficient estimates of roughly +50 after treatment and roughly 0 before treatment (since that's how I've specified the DGP). Instead, I'm getting estimates of roughly -50 before treatment and roughly 0 after treatment. I don't have this issue if I run a standard diff-in-diff. What am I doing wrong here? Thanks in advance for the help!
I was trying to wrap my head around running event studies in Stata, so I made some fake data (code, data, regression output below). My issue is that I expect to be getting coefficient estimates of roughly +50 after treatment and roughly 0 before treatment (since that's how I've specified the DGP). Instead, I'm getting estimates of roughly -50 before treatment and roughly 0 after treatment. I don't have this issue if I run a standard diff-in-diff. What am I doing wrong here? Thanks in advance for the help!
Code:
clear all set seed 333 set obs 3 g state = _n g state_fe = runiform(-3,3) expand 6 sort state g year = (state != state[_n-1]) replace year = year[_n-1]+1 if year == 0 g year_fe = 0 forvalues YEAR = 0/6 { local fe = runiform(-3,3) replace year_fe = `fe' if year == `YEAR' } g treated_state = (state == 2) g treated_time = (year >= 4) g treated = treated_state * treated_time g outcome = 50 * treated + state_fe + year_fe + rnormal() gen interaction = 0 forvalues YEAR = 1/6{ replace interaction = treated_state * `YEAR' if year == `YEAR' } reg outcome treated i.state i.year reg outcome ib4.interaction i.state i.year
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(state state_fe year year_fe treated_state treated_time treated outcome interaction) 1 2.2551877 1 -1.6628886 0 0 0 1.9787244 0 1 2.2551877 2 2.988468 0 0 0 6.868975 0 1 2.2551877 3 -2.3007996 0 0 0 -1.0354497 0 1 2.2551877 4 2.301502 0 1 0 4.602682 0 1 2.2551877 5 -.12248517 0 1 0 .6440572 0 1 2.2551877 6 -1.6121435 0 1 0 .3240579 0 2 -1.4768895 1 -1.6628886 1 0 0 -4.1191525 1 2 -1.4768895 2 2.988468 1 0 0 -.1563899 2 2 -1.4768895 3 -2.3007996 1 0 0 -4.4726853 3 2 -1.4768895 4 2.301502 1 1 1 50.23074 4 2 -1.4768895 5 -.12248517 1 1 1 49.10887 5 2 -1.4768895 6 -1.6121435 1 1 1 46.03123 6 3 -.8539335 1 -1.6628886 0 0 0 -1.5823573 0 3 -.8539335 2 2.988468 0 0 0 2.2859316 0 3 -.8539335 3 -2.3007996 0 0 0 -3.5709186 0 3 -.8539335 4 2.301502 0 1 0 .04213403 0 3 -.8539335 5 -.12248517 0 1 0 -.9253201 0 3 -.8539335 6 -1.6121435 0 1 0 -1.445516 0 end
Comment