Hi all,
I am conducting an event study to test the volatility of stock market returns is affected after an event. I have currently come up with this code, I have a sample of 10 companies, and 4 events. I am currently working on the first event's data.
Code:
gen predicted_return=.
gen predicted_variance=.
gen nIndicator = _n
tsset nIndicator
forvalues i=1(1)8 {
l id company_id if id==`i' & dif==0
arch return mkt_return if id==`i' & estimation_window==1, arch(1) garch(1) nolog
predict p if id==`i'
replace predicted_return = p if id==`i'
drop p
local tInd = nIndicator[dif==0 & id==`i']
predict p if id==`i', variance dynamic(`tInd')
replace predicted_variance = p if id==`i' & event_window==1
drop p
}
sort company_id bcal_date
gen abnormal_variance = return_sd-predicted_variance
by company_id: egen average_volatility = total(abnormal_variance) if event_window==1
I then wanted to compute a test statistic similar to the way the princeton event study website has computed it, only theirs is for return, and mine is for volatility:
Princeton code:
sort id date
by id: egen ar_sd_est = sd(abnormal_return) if estimation_window==1
bysort id: egen ar_sd = max(ar_sd_est)
gen test2 =(1/sqrt(21)) * (cumulative_abnormal_return/ar_sd)
list company_id cumulative_abnormal_return test if dif ==0
reg cumulative_abnormal_return if dif==0, robust
I just wanted to ask how to compute the test statistic, and if I am correctly determining whether the average volatility within the window is correctly computed by adjusting the Princeton code.
Thank you!
I am conducting an event study to test the volatility of stock market returns is affected after an event. I have currently come up with this code, I have a sample of 10 companies, and 4 events. I am currently working on the first event's data.
Code:
gen predicted_return=.
gen predicted_variance=.
gen nIndicator = _n
tsset nIndicator
forvalues i=1(1)8 {
l id company_id if id==`i' & dif==0
arch return mkt_return if id==`i' & estimation_window==1, arch(1) garch(1) nolog
predict p if id==`i'
replace predicted_return = p if id==`i'
drop p
local tInd = nIndicator[dif==0 & id==`i']
predict p if id==`i', variance dynamic(`tInd')
replace predicted_variance = p if id==`i' & event_window==1
drop p
}
sort company_id bcal_date
gen abnormal_variance = return_sd-predicted_variance
by company_id: egen average_volatility = total(abnormal_variance) if event_window==1
I then wanted to compute a test statistic similar to the way the princeton event study website has computed it, only theirs is for return, and mine is for volatility:
Princeton code:
sort id date
by id: egen ar_sd_est = sd(abnormal_return) if estimation_window==1
bysort id: egen ar_sd = max(ar_sd_est)
gen test2 =(1/sqrt(21)) * (cumulative_abnormal_return/ar_sd)
list company_id cumulative_abnormal_return test if dif ==0
reg cumulative_abnormal_return if dif==0, robust
I just wanted to ask how to compute the test statistic, and if I am correctly determining whether the average volatility within the window is correctly computed by adjusting the Princeton code.
Thank you!