This allows for the interaction between treat and time_to_treat to occur for each state.
Otherwise, there may be some NAs and the estimations will be off.
g time_to_treat = year - _nfd
replace time_to_treat = 0 if missing(_nfd)
this will determine the difference
btw controls and treated states
g treat = !missing(_nfd)
Stata won't allow factors with negative values, so let's shift
time-to-treat to start at 0, keeping track of where the true -1 is
summ time_to_treat
g shifted_ttt = time_to_treat - r(min)
summ shifted_ttt if time_to_treat == -1
local true_neg1 = r(mean)
Regress on our interaction terms with FEs for group and year,
clustering at the group (state) level
use ib# to specify our reference group
reghdfe asmrs ib`true_neg1'.shifted_ttt pcinc asmrh cases, a(stfips year) vce(cluster stfips)
--> For the regression in the last line, i do not see the interaction term: treat## ib`true_neg1'.shifted_ttt. Is it a typo? Or is there a logic behind not including the interaction with "treat" variable?
For this code:
use "https://raw.githubusercontent.com/LOST-STATS/LOST-STATS.github.io/master/Model_Estimation/Data/Event_Study_DiD/bacon_example.dta", clear
create the lag/lead for treated states
fill in control obs with 0
This allows for the interaction between
treat
andtime_to_treat
to occur for each state.Otherwise, there may be some NAs and the estimations will be off. g time_to_treat = year - _nfd replace time_to_treat = 0 if missing(_nfd)
this will determine the difference
btw controls and treated states g treat = !missing(_nfd)
Stata won't allow factors with negative values, so let's shift
time-to-treat to start at 0, keeping track of where the true -1 is summ time_to_treat g shifted_ttt = time_to_treat - r(min) summ shifted_ttt if time_to_treat == -1 local true_neg1 = r(mean)
Regress on our interaction terms with FEs for group and year,
clustering at the group (state) level
use ib# to specify our reference group reghdfe asmrs ib`true_neg1'.shifted_ttt pcinc asmrh cases, a(stfips year) vce(cluster stfips)
--> For the regression in the last line, i do not see the interaction term: treat## ib`true_neg1'.shifted_ttt. Is it a typo? Or is there a logic behind not including the interaction with "treat" variable?
Thank you guys!