事件研究法——stata实现并购的超额回报率计算

花了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

你可能感兴趣的:(stata)