Monday, February 28, 2022

Graph of event study for multiple regressions using eventdd package

Using the following command and using the data, you can use an event study graph for only one set of regressions, but I want to create the same graph for multiple regressions. So, I can show how for different groups the treatment is behaving differently ( like for low-education and high education people the treatment will have a different impact). With the following code, there will be one set of regression for either: low-education or high education. But, I want to edit the following code so that I can show in the same graph how both groups are behaving since the effect of treatment and before treatment. Right now my graph looks like this ( the attached image )

BUT I WANT TO EDIT MY CURRENT CODE SO THAT FOR MULTIPLE GROUPS I CAN USE THE SAME REGRESSION TO PRODUCE THE GRAPH I'M GOING TO ATTACH IN THE COMMENT.

Code:
*** ssc install eventdd

use "http://www.damianclarke.net/stata/bacon_example.dta", clear
gen timeToTreat = year - _nfd
eventdd asmrs pcinc asmrh cases i.year i.stfips, timevar(timeToTreat) method(ols, cluster(stfips))

*Then storing the estimates

estimates store leads_lags

#delimit ;

coefplot leads_lags, keep(lead5 lead4 lead3 lead2 lead1 lag_0 lag1 lag2 lag3 lag4 lag5plus)
vertical title( "{stSerif:{bf:Figure 1. {it:Trends in On-Premises Alcohol Licenses}}}", color(black) size(large))
         xtitle("{stSerif:Years Since Law Came into Effect}") xscale(titlegap(2)) xline(6, lcolor(black))
yline(-.2 0 .2 .4 .6, lwidth(vvvthin) lpattern(dash) lcolor(black))
note("{stSerif:{it:Notes}. OLS coefficient estimates (and their 95% confidence intervals) are reported. The dependent}"
     "{stSerif:variable is equal to the number of on-premises liquor licences per 1,000 population in county {it:c}}"
     "{stSerif: and year {it:t}. The controls include year fixed effects and the data cover the period 1977-2011.}", margin(small))
graphregion(fcolor(white) lcolor(white) lwidth(vvvthin) ifcolor(white) ilcolor(white)  
ilwidth(vvvthin)) ciopts(lwidth(*3) lcolor(black)) mcolor(black) ;

#delimit cr

graph export "Anderson_Fig1_v1.png", as(png) replace

No comments:

Post a Comment