事件研究法——stata實現併購的超額回報率計算

林夕水心2發表於2019-11-05

花了3天時間,包括一天的等待(迴歸過程真的好慢),終於搞清楚了用市場模型針對一個公司多個事件的超額回報率計算。
以下為stata的實現過程(借鑑了普林斯頓大學的教程https://dss.princeton.edu/online_help/stats_packages/stata/eventstudy.html):

*1.合併併購事件
use /Users/DATA/GTA_M&A_Main_累計超額收益率.dta, clear
joinby companyid using 日個股收益率07_19_total_merge.dta

*2.處理資料,生成dif /此處由於一個公司會有多個事件,所以需要sort 多個變數,其中 firstdeclaredate為併購的首次宣告日/

sort companyid firstdeclaredate date
by companyid firstdeclaredate :gen date_num = _n
by companyid firstdeclaredate :gen target = date_num if date == firstdeclaredate
egen td = min(target),by(companyid firstdeclaredate)
drop target
gen dif = date_num - td

*3.設定時間視窗
by companyid firstdeclaredate :gen event_window = 1 if dif >= -1 & dif <= 1
egen count_event_obs = count(event_window),by(companyid firstdeclaredate )
by companyid firstdeclaredate :gen estimation_window = 1 if dif >= -150 & dif < -30
egen count_est_obs = count(estimation_window),by(companyid firstdeclaredate)
replace event_window=0 if event_window ==.
replace estimation_window=0 if estimation_window ==.
tab companyid if count_event_obs<3
tab companyid if count_est_obs<120
drop if count_event_obs<3
drop if count_est_obs<120

4.估計事件期間的正常報酬率
set more off /
this command just keeps stata from pausing after each screen of output */

gen predicted_return=.
egen id=group(companyid firstdeclaredate )
/此處id也要考慮一個公司的多個事件/
forvalues i=1(1)8 { /*note: replace 8 with the highest value of id */
l id companyid if id==i' & dif==0 reg dretwd cdretwdos if id==i’ & estimation_window1
predict p if id
i' replace predicted_return = p if id==i’ & event_window==1
drop p
}

*5.計算非正常報酬率與累計非正常報酬率
sort id date
gen abnormal_return=dretwd-predicted_return if event_window==1
by id: egen cumulative_abnormal_return = sum(abnormal_return)

*6.檢驗顯著性
sort id date
by id: egen ar_sd = sd(abnormal_return)
gen test =(1/sqrt(3)) * ( cumulative_abnormal_return /ar_sd)
list companyid firstdeclaredate cumulative_abnormal_return test if dif==0

*7.輸出結果
outsheet eventid Main_institutionid companyid firstdeclaredate cumulative_abnormal_return test using stats.csv if dif==0, comma names

*8.對整個事件做穩健性檢驗
reg cumulative_abnormal_return if dif==0, robust

相關文章