馃攳
Event Study analysis in Stata - by Samsun - YouTube
Channel: Learn Coding with Us
[1]
Hello everyone, welcome back to our聽
channel. um this is Samsun. Today I will聽聽
[9]
um talk about how you can聽
run an even study in Stata.
[18]
So there are lots of paper which is talk about聽
even studies you can find um i include some of聽聽
[28]
them over here you can see. um and um so聽
before i proceed um so you can say what is聽聽
[42]
even study? So i would say even study is another聽
version of uh difference-in-difference estimation.聽聽
[53]
um and when uh do we need to use even study?聽
um so when um i would say when there is a聽聽
[65]
variation in treatment time timing or聽
heterogeneous treatment effect. um this is um聽聽
[76]
like the treatment occurs in different time for聽
different reason, place or a group of people.聽聽
[84]
So that time um you can use an even study聽
instead of difference-in-difference,聽聽
[93]
the regular difference-in-difference聽
estimation. Then um you can find um聽聽
[101]
I have I mean it will be a good analysis聽
than difference-in-difference uh estimation.聽聽
[110]
So today I will show you an example from uh聽
Stata. um um so if um and i'll uh use this command聽聽
[125]
uh event dd. So if you don't have this command聽
installed in your Stata then you can just write聽聽
[135]
that much um "ssc install eventdd", then it聽
will install in your computer. In my computer,聽聽
[146]
it's already installed, so i can just um use comma聽
replace. So then it will install on my computer.聽聽
[159]
Okay, you can see, it's installed聽
now. Now um I am going to load data聽聽
[167]
from Stata. And this data is from聽
Stevenson and Wolfers (2006) um analysis on聽聽
[179]
no-fault divorce reforms and female suicide and聽
you can find these from Web. So yeah i will run聽聽
[197]
that much to load my data. So you can see聽
the load the data is loaded in my Stata.
[210]
Okay, so um I am going to browse uh to look at聽
how my data looks like. So you can see the first聽聽
[221]
uh variable is um uh state um fips code,聽
that means they are states um and state code聽聽
[233]
and then year um that means the year of聽
survey and this um _nfd uh this is a no-fault聽聽
[247]
divorce onset that means uh um the time for each聽
state take a no-fault divorce reform. And um so聽聽
[264]
if you look at this variable _nfd then you can see聽
um it's different for it is different for each um聽聽
[278]
state. So maybe you can just tab stfips _nfd,聽
then you can see better. Yeah, here you can see聽聽
[297]
a better um you can understand better. uh you聽
can see like this um state um 20 state code 20,聽聽
[310]
the reform happened in 1960 um 1969 and聽
you can see this state code for 45 also聽聽
[326]
happened in 1969. So yeah so you can see聽
um also you can see um and you can see the聽聽
[342]
the reform happened from 1969 to 1988聽
and it's different for each state.
[358]
Okay, and um so our uh and you can see聽
this post means the post period of um聽聽
[371]
of this reform uh or the I mean the period聽
begins from the reform to post um period.聽聽
[381]
So for example, you can see聽
for state 1 um here is some聽聽
[389]
some survey time but the reform happened in聽
1971. So until you can see until the is 1971聽聽
[403]
for those year, the post is equal to zero and聽
from 1971 you can see the post equal to one um聽聽
[416]
yeah for all of the period聽
which is um a greater than 1971.
[426]
so it is um true for all of the states.
[434]
And now um yeah so that means聽
post is our treatment dummy.聽聽
[442]
And um our dependent variable is the women's聽
suicide rate, um women suicide um mortality.聽聽
[453]
So this is our asmrs is our independent variable聽
sorry dependent variable uh our outcome variable.聽聽
[465]
And uh this uh pcinc, asmrh, cases , weight,聽
and copop all of them are independent variables.聽聽
[481]
So this one is per capita income, this is the聽
cases is the AFDC cases, copop is population.聽聽
[493]
Okay, so now I am going to um
[501]
i am going to create a standard event time聽
variable uh which will give us um the time聽聽
[509]
and the passage of the event for each state. So聽
what I'm doing um I am subtracting this reform聽聽
[522]
time from our actual year. So if I run聽
this one, then um and if you browse again聽聽
[537]
then you can see this variable now creating like聽
this year minus _nfd. So this is if 1964 minus聽聽
[552]
1971, which is giving us negative 7 that means聽
7 years before um before the reform, okay.聽聽
[566]
And like this one is the same year so this聽
is zero. And those are the post periods,聽聽
[576]
so those are the positive years you can look at.
[582]
um now um so uh it is good for even studies,聽
we sometimes graph and we see how um聽聽
[600]
this reform looks like for um every year. So um聽
so this is the command I will be using to find the聽聽
[612]
even study plot uh which is eventdd. And this is聽
our the first one is our dependent variable or our聽聽
[622]
outcome variable which is female suicide and those聽
three variables are independent or covariates and聽聽
[634]
i will use a year and state fixed聽
effects. And this timevar(timetoTreat)聽聽
[645]
this is the time uh will give us the聽
for every every period from the reform聽聽
[655]
um period yeah every time from the reform and聽
I will be clustered at the state level. And聽聽
[666]
those are the graph those are the options聽
for graphs. Now if I run this command,聽聽
[678]
so you can see a nice graph for each period聽
of time the suicide per 1 million women聽聽
[695]
before the reform and after the reform. So聽
these um you can see this solid uh vertical line聽聽
[706]
um this is the baseline uh which is聽
omitted um in the in our analysis and um聽聽
[719]
and also it indicates that the one year聽聽
[726]
before to the adoption of the reform in each聽
reforming state. Okay, and these those are the the聽聽
[739]
point um estimates are displayed and these聽
are the 95 percent confidence interval,聽聽
[750]
okay. And um yeah and then you can see from the聽
graph how much is different for each period for聽聽
[761]
each state it's very different um okay. So um so聽
you can um you can show a regression result for聽聽
[776]
um for this even studies. So if you don't聽
specify the estimation method, eventdd聽聽
[786]
uses Stata's regress command to estimate the聽
model by the ordinary least squares regression.聽聽
[797]
um so if you specify the ols option, yeah you聽
will um obtain the same result over here method聽聽
[809]
um over here method fe so you can use聽
um ols instead of fe. So um and if you聽聽
[824]
specify this one like here I聽
specify fe that means it will聽聽
[831]
um give us a fixed effect estimator uh from聽
these eventdd commands. um So if I run this one,聽聽
[848]
so then this first one uh it gives us this聽
one is giving us the ols regression for this聽聽
[857]
this one. You can see this is here聽
it's saying linear regression. But聽聽
[865]
for this one uh I have specified that this method聽
will be a fixed effect and uh the estimator will聽聽
[876]
be the fixed effect estimator. So then um聽
this is for the graph, so if I run this one,聽聽
[888]
this will give us the graph for聽
from the fixed effect estimator聽聽
[893]
and um for the model you can use uh that much um聽
until this the cluster uh cluster um state code.
[910]
so
[913]
then
[918]
yeah so you can see this is our result and you can聽
see it's a fixed effect uh regression analysis,聽聽
[928]
so this coefficient now is um for聽
uh is a fixed effect estimator.
[938]
yeah and you can see those are for聽
the main um independent variable,聽聽
[945]
these are the year fixed effects, and those are聽
the lead and lags. um that means that before um聽聽
[954]
this the lead will be the after uh reform period聽
and this lag will be the pre pre-reformed period聽聽
[966]
okay. uh also you can do a lots of things with聽
this eventdd command. um so I mean you you can聽聽
[980]
specify as you need as you need for your research聽
um so if you run this command "help eventdd"
[994]
then you can see a lot of聽
information you can get for "eventdd"
[1004]
and um yeah lots of information um you can use uh聽
from it. Yep, so I think uh this video might be聽聽
[1021]
helpful for you guys um. Please subscribe to our聽
channel, like our videos, share with your friends.聽聽
[1033]
Stay tuned!! Thanks for watching.聽
Bye. Please, Please, Please Subscribe.
Most Recent Videos:
You can go back to the homepage right here: Homepage





