Dear all,
I am just getting started with some event studies tools in Stata. I hope you can help me clarify some things.
I am struggling particularly with the generation of an event_window variable (relative to the time of the event).
In the esplot package (@Dylan Balla-Elliott), the event_window is defined as follows.
But I am not sure if I am using the correct definition.
Here is my data example, with a time variable, a continuous variable, and a set of event indicator dummies (which are basically random shocks).
At glance I thought on the following loop to generate event_window. But some questions arise about how to handle the variable with two sequential shocks (i.e in 2009/11 and 2009/12 for eu_reg_shock). Or where two or more shocks are included in the time window. If the window is too large, it will be problematic, I assume.
Further on, I want to analyze if these shocks affect the continuous variable before and after. So I plotted in the following way.
Ideally, I need to normalize the continuous variable (with mean of one) before the shock.
Here is on plot from Scott R. Baker Nicholas Bloom Stephen J. Terry (2022), that I wish to replicate for these three shocks but I am stuck in the normalization part.

References:
Scott R. Baker Nicholas Bloom Stephen J. Terry (2022). https://www.nber.org/papers/w27167
Dylan Balla-Elliott. https://dballaelliott.github.io/esplot/index.html
I am just getting started with some event studies tools in Stata. I hope you can help me clarify some things.
I am struggling particularly with the generation of an event_window variable (relative to the time of the event).
In the esplot package (@Dylan Balla-Elliott), the event_window is defined as follows.
Code:
event_indicator = <current_time> == <time of event> event_time = <current_time> - <time of event>
Here is my data example, with a time variable, a continuous variable, and a set of event indicator dummies (which are basically random shocks).
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str7 modate float epeu_lvl byte(cop_shock unpri_reg_shock eu_reg_shock) float tid "2004/1" 75.34063 0 0 0 1 "2004/2" 76.99823 0 0 0 2 "2004/3" 125.02164 0 0 0 3 "2004/4" 109.83804 0 0 0 4 "2004/5" 114.84982 0 0 0 5 "2004/6" 99.84531 0 0 0 6 "2004/7" 115.9254 0 0 0 7 "2004/8" 77.3424 0 0 0 8 "2004/9" 89.59677 0 0 0 9 "2004/10" 120.00146 0 0 0 10 "2004/11" 127.93832 0 0 0 11 "2004/12" 83.33497 1 0 1 12 "2005/1" 58.94662 0 0 0 13 "2005/2" 74.97708 0 0 0 14 "2005/3" 81.45479 0 0 0 15 "2005/4" 89.07868 0 0 0 16 "2005/5" 99.44091 0 0 0 17 "2005/6" 99.41497 0 0 0 18 "2005/7" 85.08384 0 0 0 19 "2005/8" 82.83349 0 0 0 20 "2005/9" 160.47383 0 0 0 21 "2005/10" 71.51886 0 0 0 22 "2005/11" 95.44765 0 0 0 23 "2005/12" 61.47662 1 0 1 24 "2006/1" 83.96114 0 0 0 25 "2006/2" 60.63415 0 0 0 26 "2006/3" 79.82993 0 0 0 27 "2006/4" 89.04356 0 0 0 28 "2006/5" 82.44514 0 0 0 29 "2006/6" 89.85152 0 0 0 30 "2006/7" 82.00437 0 0 0 31 "2006/8" 58.86663 0 0 0 32 "2006/9" 76.82971 0 0 0 33 "2006/10" 71.2218 0 0 0 34 "2006/11" 73.84509 1 0 0 35 "2006/12" 74.91799 0 0 0 36 "2007/1" 62.33881 0 0 0 37 "2007/2" 58.51786 0 0 0 38 "2007/3" 71.11645 0 0 0 39 "2007/4" 65.16531 0 0 0 40 "2007/5" 54.99327 0 0 0 41 "2007/6" 60.84606 0 0 0 42 "2007/7" 47.69234 0 0 0 43 "2007/8" 94.66286 0 0 0 44 "2007/9" 166.7332 0 0 0 45 "2007/10" 96.88046 0 0 0 46 "2007/11" 97.73734 0 0 0 47 "2007/12" 98.01473 1 0 1 48 "2008/1" 160.25905 0 0 1 49 "2008/2" 128.78455 0 0 0 50 "2008/3" 139.87073 0 0 0 51 "2008/4" 96.74758 0 0 0 52 "2008/5" 76.82344 0 0 0 53 "2008/6" 106.42784 0 0 0 54 "2008/7" 87.93302 0 0 0 55 "2008/8" 92.29639 0 0 0 56 "2008/9" 156.0435 0 0 0 57 "2008/10" 216.5918 0 0 0 58 "2008/11" 156.77446 1 0 0 59 "2008/12" 136.78456 0 0 0 60 "2009/1" 159.99384 0 0 0 61 "2009/2" 139.69698 0 0 0 62 "2009/3" 133.46071 0 0 0 63 "2009/4" 119.9992 0 0 1 64 "2009/5" 122.9601 0 0 0 65 "2009/6" 113.23891 0 0 0 66 "2009/7" 95.94823 0 0 0 67 "2009/8" 91.37744 0 0 0 68 "2009/9" 104.3236 0 0 0 69 "2009/10" 105.04014 0 0 0 70 "2009/11" 133.00749 1 0 1 71 "2009/12" 115.2626 0 0 1 72 "2010/1" 142.00356 0 0 0 73 "2010/2" 136.73906 0 0 0 74 "2010/3" 137.8383 0 0 0 75 "2010/4" 152.78447 0 0 0 76 "2010/5" 203.30525 0 0 0 77 "2010/6" 171.40266 0 0 1 78 "2010/7" 186.55524 0 0 0 79 "2010/8" 172.81606 0 0 0 80 "2010/9" 161.69014 0 0 0 81 "2010/10" 186.1411 0 1 0 82 "2010/11" 172.68817 1 0 0 83 "2010/12" 183.076 0 0 0 84 "2011/1" 143.03174 0 0 0 85 "2011/2" 122.44579 0 0 0 86 "2011/3" 154.4015 0 0 0 87 "2011/4" 145.5086 0 0 0 88 "2011/5" 134.21507 0 0 1 89 "2011/6" 168.2959 0 0 0 90 "2011/7" 183.40234 0 0 0 91 "2011/8" 230.29893 0 0 0 92 "2011/9" 280.05814 0 0 0 93 "2011/10" 241.75185 0 0 0 94 "2011/11" 304.60022 1 0 0 95 "2011/12" 228.8716 0 0 0 96 "2012/1" 216.73445 0 0 0 97 "2012/2" 193.44435 0 0 0 98 "2012/3" 177.4927 0 0 0 99 "2012/4" 216.99586 0 0 0 100 end
Code:
g event_time =0 if eu_reg_shock==1 foreach v of numlist 1/5 { replace event_time = `v' if eu_reg_shock[_n+`v']==1 replace event_time = -`v' if eu_reg_shock[_n-`v']==1 }
Code:
graph bar (mean) epeu_lvl, over(event_time)
Here is on plot from Scott R. Baker Nicholas Bloom Stephen J. Terry (2022), that I wish to replicate for these three shocks but I am stuck in the normalization part.
References:
Scott R. Baker Nicholas Bloom Stephen J. Terry (2022). https://www.nber.org/papers/w27167
Dylan Balla-Elliott. https://dballaelliott.github.io/esplot/index.html
Comment