Hi guys.
I am running an event study and I'd be very helpful if you could help me with the below:
These are my codes for the event study:
I'd like to:
1) create a dummy variable in my regressions such that it identifies an event and assign a value of 0 on event date and 1 otherwise.
2) have several dummy variables for each of the event date in my sample.
Any ideas how I should proceed with that?
The use of the dummy variable is to help me identify which events have a significant impact on a sample of 16 stock market indices.
A summary of dataset: 1) Returns (16) and market return data - daily observations from Jan 04 to Dec 16 & 2) Events list - contains 1,324 events
Thank you for your help.
Regards Parvesh
I am running an event study and I'd be very helpful if you could help me with the below:
These are my codes for the event study:
Code:
clear
capture cd "C:\Users\Parvesh\Desktop\Event Study Statistics\16 Indices\6 Day CAR"
set obs 1
g fake = .
save 6day_car, replace
* cleaningevents file
import delimited using GTD.csv, clear
drop city perpetrator1 guncertain1 perpetrator2 guncertain2 perpetrator3 guncertain3 targettype1 targettype2 targettype3 region attacktype1 attacktype2 attacktype3 weapontype1 weapontype2 weapontype3 weapontype4
rename date date_string
g date = date(date_string,"DMY")
format date %td
sort date
drop date_string
g date_id = _n
tsset date_id
* Drop events occuring on non-trading days
gen dow = dow(date)
drop if dow(date)==0 | dow(date)==6
drop dow
sort date
rename date event_date
g nnn = 1
g obs = _n
save eventsdates, replace
* Calculating market returns using SP500 as proxy for market portfolio
import delimited using sp500.csv, clear
rename date date_string
rename sp500 market
generate date = date(date_string,"DMY")
format date %td
sort date
g date_id = _n
keep market date_id date
drop if market==.
tsset date_id
generate returnmarket = ln(market) - ln(L.market)
sort date
order date, first
save marketret, replace
* Calculating indices returns and merging with market returns file
import delimited using indices.csv, clear
rename date date_string
generate date = date(date_string,"DMY")
format date %td
sort date
drop date_string
g date_id = _n
tsset date_id
local vars atx bel20 omxc20 omxh cac40 dax30 athex iseq mib aex obx psi20 ibex35 omxs30 smi ftse100
foreach var of local vars {
gen return_`var' = ln(`var') - ln(L.`var')
}
sort date
merge 1:1 date using marketret
drop _merge market
sort date
g nnn = 1
drop atx bel20 omxc20 omxh cac40 dax30 athex iseq mib aex obx psi20 ibex35 omxs30 smi ftse100
save allreturns, replace
* merging events file with returns file
use eventsdates, clear
drop date_id
forvalues i = 1/1324 {
preserve
keep if obs == `i'
joinby nnn using allreturns
sort date
drop date_id
g date_id = _n
gen day_cnt = date_id
gen target_day = day_cnt if date==event_date
egen max_target_day = max(target_day)
gen evday = day_cnt-max_target_day
drop day_cnt target_day max_target_day
sort evday
gen evt_window=1 if evday>=0 & evday<=6
gen est_window=1 if evday<=-11 & evday>=-30
drop if evt_window==. & est_window==.
foreach var of local vars {
reg return_`var' returnmarket if est_window==1
gen rmse_`var' = e(rmse)
predict phat_`var'
gen ar_`var' = return_`var' - phat_`var' if evt_window==1
drop phat_`var'
}
drop if evt_window==.
drop est_window nnn
***************************************************
*Display the CAR and its Test Statistic
foreach var of local vars {
egen car_`var' = sum(ar_`var')
gen tstat_`var' = car_`var'/(rmse_`var'*sqrt(_N))
drop return_`var' rmse_`var' ar_`var'
}
drop returnmarket date_id evday evt_window date
* DO EVENT analysis, generate CAR in 1/1
keep in 1/1
append using 6day_car
save 6day_car, replace
restore
}
use 6day_car, clear
order event_date, first
sort event_date
1) create a dummy variable in my regressions such that it identifies an event and assign a value of 0 on event date and 1 otherwise.
2) have several dummy variables for each of the event date in my sample.
Any ideas how I should proceed with that?
The use of the dummy variable is to help me identify which events have a significant impact on a sample of 16 stock market indices.
A summary of dataset: 1) Returns (16) and market return data - daily observations from Jan 04 to Dec 16 & 2) Events list - contains 1,324 events
Thank you for your help.
Regards Parvesh
