Event Studieswith Stata
An event studyis used to examine reactions of the market to events of interest. A simpleevent study involves the following steps:
• Cleaning the Data andCalculating the Event Window
• Estimating NormalPerformance
• Calculating Abnormaland Cumulative Abnormal Returns
• Testing forSignificance
• Testing Across AllEvents
This document isdesigned to help you conduct event studies using Stata. We assume that youalready have data with a date variable, which we call "date", and a company identifier,which we have called "company_id".If you need to prepare your data or want to try out the commands with oursample data, go to data preparation page.
We also assumethat you have a basic familiarity with Stata. If you need assistance with Statacommands, you can find out more about it here. Your task will be much easier ifyou enter the commands in a do file, which is a text file containing a list ofStata commands.
Cleaning thedata and Calculating the Event and Estimation Windows
It's likely thatyou have more observations for each company than you need. It's also possiblethat you do not have enough for some. Before you can continue, you must makesure that you will be conducting your analyses on the correct observations. Todo this, you will need to create a variable, dif, that will count the number ofdays from the observation to the event date. This can be either calendar daysor trading days.
For number oftrading days:
sort company_iddate
by company_id:gen datenum=_n
by company_id:gen target=datenum if date==event_date
egentd=min(target), by(company_id)
drop target
gendif=datenum-td
For calendardays:
gendif=date-event_date
As you can see,calculating the number of trading days is a little trickier than calendar days.For trading days, we first need to create a variable that counts the number ofdays within each company_id. Then we determine which observation occurs on theevent date. We create a variable with the event date's day number on all of theobservations within that company_id. Finally, we simply take the differencebetween the two, creating a variable, dif, that counts the number of daysbetween each individual observation and the event day. Next, we need to makesure that we have the minimum number of observations before and after the eventdate, as well as the minimum number of observations before the event window forthe estimation window. Let's say we want 2 days before and after the event date(a total of 5 days in the event window) and 30 days for the estimation window.(You can of course change these numbers to suit your analysis.)
by company_id:gen event_window=1 if dif>=-2 & dif<=2
egencount_event_obs=count(event_window), by(company_id)
by company_id:gen estimation_window=1 if dif<-30 & dif>=-60
egencount_est_obs=count(estimation_window), by(company_id)
replaceevent_window=0 if event_window==.
replaceestimation_window=0 if estimation_window==.
The procedurefor determining the event and estimation windows is the same. First we create avariable that equals 1 if the observation is within the specified days. Second,we create another variable that counts how many observations, within eachcompany_id, has a 1 assigned to it. Finally, we replace all the missing valueswith zeroes, creating a dummy variable. You can now determine which companiesdo not have a sufficient number of observations.
tab company_idif count_event_obs<5
tab company_idif count_est_obs<30
The"tab" will produce a list of company_ids that do not have enoughobservations within the event and estimation windows, as well as the totalnumber of observations for those company_ids. To eliminate these companies:
drop ifcount_event_obs < 5
drop ifcount_est_obs < 30
You should makesure the dataset has been saved under a different name before dropping anyobservations!
At this pointyou can also drop some variables you won't need any longer: count_event_obs andcount_est_obs.
EstimatingNormal Performance
Now we are atthe point where we can actually start an analysis. First we need a way toestimate Normal Performance. To do this, we will run a seperate regression foreach company using the data within the estimation window and save the alphas(the intercept) and betas (the coefficient of the independent variable). Wewill later use these saved regression equations to predict normal performanceduring the event window.
Note thatreturn, the dependent variable in our regression, is simply the CRSP variablefor a given stock's return, while the independent variable vretd that we use topredict ret is the value-weighted return of an index for whatever exchange thestock trades on. Use the equivalent variables for your dataset
set more off /*this command just keeps stata from pausing after each screen of output */
genpredicted_return=.
egenid=group(company_id)
/* for multipleevent dates, use: egen id = group(group_id) */
forvaluesi=1(1)N { /*note: replace N with the highest value of id */
l id company_id if id==`i' &dif==0 *其中l是list的意思
reg ret market_return if id==`i' &estimation_window==1
predict p if id==`i'
replace predicted_return = p if id==`i'& event_window==1
drop p
}
Here, we createda variable "id" that numbers the companies from 1 to however manythere are. The N is the number of company-event combinations that have completedata. This process iterates over the companies, runs a regression in theestimation window for each, and then uses that regression to predict a 'normal'return in the event window.
Abnormal andCumulative Abnormal Returns
We can nowcalculate the abnormal and cumulative abnormal returns for our data. The dailyabnormal return is computed by subtracting the predicted normal return from theactual return for each day in the event window. The sum of the abnormal returnsover the event window is the cumulative abnormal return.
sort id date
genabnormal_return=ret-predicted_return if event_window==1
by id: egencumulative_abnormal_return = sum(abnormal_return)
Here we simplycalculate the abnormal return for each observation in the event window. Then weset the cumulative abnormal return equal to the sum of the abnormal returns foreach company.
Testing forSignificance
We are going tocompute a test statistic, test, to check whether the average abnormal returnfor each stock is statistically different from zero.*
TEST= ((ΣAR)/N)/ (AR_SD/sqrt(N))
where AR is theabnormal return and AR_SD is the abnormal return standard deviation. If theabsolute value of test is greater than 1.96, then the average abnormal returnfor that stock is significantly different from zero at the 5% level. The valueof 1.96 comes from the standard normal distribution with a mean of 0 and a standarddeviation of 1. 95% of the distribution is between ±1.96.
sort id date
by id: egenar_sd = sd(abnormal_return)
gen test=(1/sqrt(number of days in event window)) * ( cumulative_abnormal_return/ar_sd)
list company_idcumulative_abnormal_return test if dif==0
Note: this testuses the sample standard deviation. A less conservative alternative is to usethe population standard deviation. To derive this from the sample standarddeviation produced by Stata, multiply ar_sd by the square root of n-1/n; in ourexample, by the square root of 4/5.
This will outputthe results of your event study into an Excel-readable spreadsheet file:
outsheet company_id event_datecumulative_abnormal_return test using stats.csv if dif==0, comma names
Testing AcrossAll Events
Instead of, orin addition to, looking at the average abnormal return for each company, youprobably want to calculate the cumulative abnormal for all companies treated asa group. Here's the code for that:
regcumulative_abnormal_return if dif==0, robust
The P-value onthe constant from this regression will give you the significance of thecumulative abnormal return across all companies. This test preferable to at-test because it allows you to use robust standard errors.
Further Reading
Capital MarketResponses To Environmental Performance In Developing Countries, section t hree:Event Study Methodology, working paper from the World Bank
Note
* Thank you toKim Baum for useful feedback
扫码加好友,拉您进群



收藏
