Hi,
I am using Stata 15.1 on Mac. Co-authors and I are attempting to replicate results from the package eventstudy2 from SSC using our own manual code, using the example dataset provided with the package (Earnings_surprises.dta, Factor_returns.dta, and security_returns.dta). The only other package we use is rangestat from SSC.
We are mainly focused on cumulative average abnormal returns (CAAR) and we get very close to the output from eventstudy2. However, it is not the same which worries us. In a 1-factor CAPM model, eventstudy2 estimates CAAR=0.0321 and we estimate CAAR=0.0325. In a 3-factor model, eventstudy2 estimates CAAR=0.0324 and we estimate CAAR=0.0348. For brevity, I will just post the 1-factor model below.
We focus on an event window of [-1,1] and all other parameters are set to the default from eventstudy2. We would really appreciate views on why our results differ and if we are missing anything obvious (quite possible!).
The three example datasets look like the following:
Produce CAAR from eventstudy2 as a benchmark result (CAARE in carfile.dta):
Our code to replicate:
Many thanks.
I am using Stata 15.1 on Mac. Co-authors and I are attempting to replicate results from the package eventstudy2 from SSC using our own manual code, using the example dataset provided with the package (Earnings_surprises.dta, Factor_returns.dta, and security_returns.dta). The only other package we use is rangestat from SSC.
We are mainly focused on cumulative average abnormal returns (CAAR) and we get very close to the output from eventstudy2. However, it is not the same which worries us. In a 1-factor CAPM model, eventstudy2 estimates CAAR=0.0321 and we estimate CAAR=0.0325. In a 3-factor model, eventstudy2 estimates CAAR=0.0324 and we estimate CAAR=0.0348. For brevity, I will just post the 1-factor model below.
We focus on an event window of [-1,1] and all other parameters are set to the default from eventstudy2. We would really appreciate views on why our results differ and if we are missing anything obvious (quite possible!).
Code:
ssc install eventstudy2 net get eventstudy2 ssc install rangestat
Code:
//Earnings_surprises.dta clear input int Date double Earnings_surprise float(Market_reference Security_id) 18477 .142857149243355 4 1 18312 .294117659330368 4 2 17772 .333333343267441 4 3 18317 .179775282740593 4 4 18319 .151898726820946 4 5 end format %d Date
Code:
//Factor_returns.dta clear input int Date byte Market_reference float(MKT SMB HML risk_free_rate) 17714 3 -.01556425 .003552195 -.006175981 .00013698408 17715 3 -.008983069 .008519101 .0018280167 .0006432207 17716 3 -.0023612224 -.009305347 .007052137 .00055780174 17717 3 -.006097221 .012784534 .0011224622 .000604795 17720 3 .017947385 -.017388338 -.0012865672 .000684176 end format %d Date
Code:
//security_returns.dta clear input int Date long Trading_volume double Price float(Market_reference Security_id Return) 16440 1111600 23.7 4 1 -.014553014 16441 1262300 23.53 4 1 -.007172996 16442 1083000 23.73 4 1 .008499787 16443 671900 23.58 4 1 -.006321113 16446 1075000 23.92 4 1 .014419 end format %d Date
Code:
net get eventstudy2 use Earnings_surprises.dta, clear eventstudy2 Security_id Date using Security_returns if Earnings_surprise > 0.05, ret(Return) car1LB(-1) car1UB(1) evwlb(-1) evwub(1) mod(FM) marketfile(Factor_returns) mar(MKT) idmar(Market_reference) risk(risk_free_rate) minesw(1) minevw(1) replace use carfile, clear
Code:
use security_returns.dta, clear merge 1:1 Security_id Date using Earnings_surprises.dta //merge with earnings_surprises drop if _merge==2 //drop earnings_surprises if not matched to any security returns drop _merge merge m:1 Date Market_reference using Factor_returns.dta //merge with factor returns drop if _merge!=3 //drop if cannot match factor returns with security returns (this will remove id's 101-104) drop _merge egen id=group(Security_id) gen ReturnE=Return-risk_free_rate //calculate excess returns gen eventdummy = Earnings_surprise!=.& Earnings_surprise!=0 //generate a dummy==1 for each earnings surprise observation gen eventdummy05= Earnings_surprise>0.05&Earnings_surprise!=. //generate dummy==1 if earnings surprise>0.05 gen eventwindow=0 //begin calculating three-day window [-1,1] sort id Date forvalues i=1/3 { replace eventwindow=`i' if eventdummy05[_n+2-`i']==1 } //label days around event day as [1,2,3] for [-1,0,1] gen windowdummy =eventwindow !=0 //create an event window dummy rangestat (reg) ReturnE MKT, interval(Date -270 -20) by(id) //estimate OLS regression by firm over interval -20 to -270 gen AbnReturn=. //create abnormal return forvalues i=1/3{ replace AbnReturn= ReturnE -b_MKT[_n-`i']*MKT - b_cons[_n-`i'] if eventwindow==`i' } //calculate abnormal returns for event window days replace AbnReturn=. if reg_nobs<1 //drop abnormal return if estimation window has less than 1 observation by id: gen CAAR= AbnReturn[_n-1]+AbnReturn[_n]+AbnReturn[_n+1] if eventdummy05==1 //calculate cumulative abnormal return per firm sum CAAR //calculate cumulative average abnormal return
Comment