cd f:\stata\eventstudy
insheet using f:\stata\eventstudy\H-stock.CSV
save H-stock, replace
clear
insheet using f:\stata\eventstudy\event.CSV
save event, replace
/* merge based on "company_id" and save*/
use event, clear
sort company_id
save, replace
use H-stock, clear
sort company_id tradedate
merge company_id using event
save, replace
/* creat variables: window, event_window, estimation_window,count_event_obs, and count_est_obs */
use H-stock, clear
sort company_id tradedate
by company_id: gen daten=_n
by company_id: gen date0=daten if tradedate==eventdate
egen dt0=min(date0), by(company_id)
by company_id: gen window=daten-dt0
by company_id: gen return=closeprice[_n]/closeprice[_n-1]-1
by company_id: gen market_return=hsi_price[_n]/hsi_price[_n-1]-1
gen predicted_return=.
egen id=group(company_id)
save, replace
by company_id:gen event_window=1 if window>=0 &window<=1
egen count_event_obs=count(event_window), by(company_id)
by company_id:gen estimation_window=1 if window<=0 &window>=-170
egen count_est_obs=count(estimation_window),by(company_id)
replace event_window=0 if event_window==.
replace estimation_window=0 if estimation_window==.
下面怎么求异常回报?