Hi all,
I've conducted an event study using this link https://dss.princeton.edu/online_hel...udy.html#clean, and at the end of it it turns out I do not have enough observations for the final CAR regression.
I deviated from the tutorial as my data concerns a single index, whereas it was using the example of a sample of firms, so perhaps that caused the issue. Alternatively I wondered if it was the fact that I wanted to look at only the returns over 1 day (with multiple dates), and so the event window code read as "gen event_window=1 if dif>=-1 & dif<=0", is there any logical problem with this?
In terms of what I wish to precisely achieve is to assess if there are CAR regarding macroeconomic events, read as irregular and multiple. The data is for one index. There are multiple events. I have price data, and % change from one price to the next. I only want to measure the change on the day of the event.
Edit: I'm using Stata 13.0
Disclaimer: I started a similar thread recently asking for assistance but was lacking code to be interrogated. I will link to this thread in that one.
Many thanks,
Toby
I've conducted an event study using this link https://dss.princeton.edu/online_hel...udy.html#clean, and at the end of it it turns out I do not have enough observations for the final CAR regression.
I deviated from the tutorial as my data concerns a single index, whereas it was using the example of a sample of firms, so perhaps that caused the issue. Alternatively I wondered if it was the fact that I wanted to look at only the returns over 1 day (with multiple dates), and so the event window code read as "gen event_window=1 if dif>=-1 & dif<=0", is there any logical problem with this?
In terms of what I wish to precisely achieve is to assess if there are CAR regarding macroeconomic events, read as irregular and multiple. The data is for one index. There are multiple events. I have price data, and % change from one price to the next. I only want to measure the change on the day of the event.
Edit: I'm using Stata 13.0
Disclaimer: I started a similar thread recently asking for assistance but was lacking code to be interrogated. I will link to this thread in that one.
Many thanks,
Toby
Code:
use eventdates, clear * Preparing the data sort company_id by company_id: gen eventcount=_N by company_id: keep if _n==1 sort company_id keep company_id eventcount save eventcount use stockdata, clear sort company_id merge company_id using eventcount tab _merge keep if _merge==3 drop _merge expand eventcount drop eventcount sort company_id date by company_id date: gen set=_n sort company_id set save stockdata2 use eventdates, clear sort company_id by company_id: gen set=_n sort company_id set save eventdates2 use stockdata2, clear merge company_id set using eventdates2 tab _merge * Cleaning the data and calculating event and estimation windows gen date2 = date(date, "DMY") format date2 %td drop date rename date2 date sort company_id date by company_id: gen datenum=_n by company_id: gen target=datenum if date==event_date egen td=min(target), by(company_id) drop target gen dif=datenum-td by company_id: gen event_window=1 if dif>=-1 & dif<=0 egen count_event_obs=count(event_window), by(company_id) by company_id: gen estimation_window=1 if dif<-30 & dif>=-60 egen count_est_obs=count(estimation_window), by(company_id) replace event_window=0 if event_window==. replace estimation_window=0 if estimation_window==. drop count_event_obs count_est_obs set more off /* this command just keeps stata from pausing after each screen of output */ gen predicted_return=. egen id = group(group_id) /* for multiple event dates, use: egen id = group(group_id) */ forvalues i=1(1)1 l id company_id if id==`i' & dif==0 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 gen abnormal_return= market_return -predicted_return if event_window==1 by id: egen cumulative_abnormal_return = sum(abnormal_return) gen test =(1/sqrt(2)) * ( cumulative_abnormal_return /ar_sd) list company_id cumulative_abnormal_return test if dif==0
Comment