Ηι,
I would need help with stata as it is the first time that I am using it and I face some difficulties. So, I want to calculate the Cumulative Abnormal returns for some event days. I have found the command to calculate the Car for one event day, however, I don't know what to do now because I have 8 event days, someone told me about using leads or lags, but I don't know how to actually use them. Please find below a sample of my data as well as, the command that I am using for calculating the car when I have one event day. I am looking forward to receive some answers and discuss further about this problem that I have. Thank you in advance.
Data sample:
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input str8 Country str15 company_id double delta_log_price long date float(SMP1 SMP2 LTRO1 LTRO2 OMT1 OMT2 OMT3 OMT4 APP) int year float date_seq
"Spain" "ES0176406066(P)" -4.51085950651685 19498 0 0 0 0 0 0 0 0 0 2013 1391
"Spain" "ES0128461037(P)" -2.305252946955238 19894 0 0 0 0 0 0 0 0 0 2014 1674
"Italy" "IT0005187940(P)" -2.2072749131897207 20079 0 0 0 0 0 0 0 0 0 2014 1804
"Spain" "ES0181222011(P)" -2.0149030205422647 20172 0 0 0 0 0 0 0 0 0 2015 1870
"Italy" "IT0004818297(P)" -1.9073390519180036 19158 0 0 0 0 0 0 0 0 0 2012 1149
"Greece" "GRS149001000(P)" -1.791759469228055 18682 0 0 0 0 0 0 0 0 0 2011 809
"Spain" "ES0181480114(P)" -1.6511921847816873 18191 0 0 0 0 0 0 0 0 0 2009 463
"Italy" "IT0005187940(P)" -1.5040773967762742 20076 0 0 0 0 0 0 0 0 0 2014 1803
"Spain" "ES0172821037(P)" -1.482098490057499 18179 0 0 0 0 0 0 0 0 0 2009 455
"Portugal" "PTSCB0AM0001(P)" -1.4816045409242153 19277 0 0 0 0 0 0 0 0 0 2012 1234
"Greece" "GRS065003006(P)" -1.4271163556401456 18464 0 0 0 0 0 0 0 0 0 2010 655
"Portugal" "PTCDU0AE0003(P)" -1.330346287187358 18408 0 0 0 0 0 0 0 0 0 2010 615
"Portugal" "PTRED0AP0010(P)" -1.286210902562908 20104 0 0 0 0 0 0 0 0 0 2015 1823
"Portugal" "PTFEN0AP0006(P)" -1.2809338454620642 18318 0 0 0 0 0 0 0 0 0 2010 551
"Italy" "PTLIT0AE0005(P)" -1.2671642647383075 19491 0 0 0 0 0 0 0 0 0 2013 1386
"Ireland" "IE0003073255(P)" -1.2367626271489267 18925 0 0 0 0 0 0 0 0 0 2011 982
"Portugal" "PTGPA0AP0007(P)" -1.2343575409526524 19198 0 0 0 0 0 0 0 0 0 2012 1177
"Spain" "ES0109260531(P)" -1.223940768703466 20256 0 0 0 0 0 0 0 0 0 2015 1929
"Italy" "PTLIT0AE0005(P)" -1.2211182112809245 19247 0 0 0 0 0 0 0 0 0 2012 1212
"Portugal" "PTCUR0AP0000(P)" -1.205222023726368 19478 0 0 0 0 0 0 0 0 0 2013 1377
"Italy" "IT0003056386(P)" -1.165009874612094 20436 0 0 0 0 0 0 0 0 0 2015 2057
"Ireland" "IE00B66ML191(P)" -1.139434283188365 18941 0 0 0 0 0 0 0 0 0 2011 994
"Portugal" "PTCUR0AP0000(P)" -1.1394342831883648 18486 0 0 0 0 0 0 0 0 0 2010 670
"Portugal" "PTGPA0AP0007(P)" -1.1332614240812837 19219 0 0 0 0 0 0 0 0 0 2012 1192
"Portugal" "PTCDU0AE0003(P)" -1.126648720891393 18443 0 0 0 0 0 0 0 0 0 2010 640
"Italy" "IT0005187940(P)" -1.123305172261155 19236 0 0 0 0 0 0 0 0 0 2012 1205
COMMANDS:
gen day_cnt = _n
gen target_day = day_cnt if date==18392
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>=-10 & evday<=20
gen est_window=1 if evday<=-11 & evday>=-220
drop if evt_window==. & est_window==.
qui reg delta_log_price if est_window==1
gen rmse = e(rmse)
predict phat
gen ar = delta_log_price - phat if evt_window==1
drop phat
drop if evt_window==0
egen car = sum(ar)
gen tstat = car/(rmse*sqrt(_N))
sum car tstat
I would need help with stata as it is the first time that I am using it and I face some difficulties. So, I want to calculate the Cumulative Abnormal returns for some event days. I have found the command to calculate the Car for one event day, however, I don't know what to do now because I have 8 event days, someone told me about using leads or lags, but I don't know how to actually use them. Please find below a sample of my data as well as, the command that I am using for calculating the car when I have one event day. I am looking forward to receive some answers and discuss further about this problem that I have. Thank you in advance.
Data sample:
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input str8 Country str15 company_id double delta_log_price long date float(SMP1 SMP2 LTRO1 LTRO2 OMT1 OMT2 OMT3 OMT4 APP) int year float date_seq
"Spain" "ES0176406066(P)" -4.51085950651685 19498 0 0 0 0 0 0 0 0 0 2013 1391
"Spain" "ES0128461037(P)" -2.305252946955238 19894 0 0 0 0 0 0 0 0 0 2014 1674
"Italy" "IT0005187940(P)" -2.2072749131897207 20079 0 0 0 0 0 0 0 0 0 2014 1804
"Spain" "ES0181222011(P)" -2.0149030205422647 20172 0 0 0 0 0 0 0 0 0 2015 1870
"Italy" "IT0004818297(P)" -1.9073390519180036 19158 0 0 0 0 0 0 0 0 0 2012 1149
"Greece" "GRS149001000(P)" -1.791759469228055 18682 0 0 0 0 0 0 0 0 0 2011 809
"Spain" "ES0181480114(P)" -1.6511921847816873 18191 0 0 0 0 0 0 0 0 0 2009 463
"Italy" "IT0005187940(P)" -1.5040773967762742 20076 0 0 0 0 0 0 0 0 0 2014 1803
"Spain" "ES0172821037(P)" -1.482098490057499 18179 0 0 0 0 0 0 0 0 0 2009 455
"Portugal" "PTSCB0AM0001(P)" -1.4816045409242153 19277 0 0 0 0 0 0 0 0 0 2012 1234
"Greece" "GRS065003006(P)" -1.4271163556401456 18464 0 0 0 0 0 0 0 0 0 2010 655
"Portugal" "PTCDU0AE0003(P)" -1.330346287187358 18408 0 0 0 0 0 0 0 0 0 2010 615
"Portugal" "PTRED0AP0010(P)" -1.286210902562908 20104 0 0 0 0 0 0 0 0 0 2015 1823
"Portugal" "PTFEN0AP0006(P)" -1.2809338454620642 18318 0 0 0 0 0 0 0 0 0 2010 551
"Italy" "PTLIT0AE0005(P)" -1.2671642647383075 19491 0 0 0 0 0 0 0 0 0 2013 1386
"Ireland" "IE0003073255(P)" -1.2367626271489267 18925 0 0 0 0 0 0 0 0 0 2011 982
"Portugal" "PTGPA0AP0007(P)" -1.2343575409526524 19198 0 0 0 0 0 0 0 0 0 2012 1177
"Spain" "ES0109260531(P)" -1.223940768703466 20256 0 0 0 0 0 0 0 0 0 2015 1929
"Italy" "PTLIT0AE0005(P)" -1.2211182112809245 19247 0 0 0 0 0 0 0 0 0 2012 1212
"Portugal" "PTCUR0AP0000(P)" -1.205222023726368 19478 0 0 0 0 0 0 0 0 0 2013 1377
"Italy" "IT0003056386(P)" -1.165009874612094 20436 0 0 0 0 0 0 0 0 0 2015 2057
"Ireland" "IE00B66ML191(P)" -1.139434283188365 18941 0 0 0 0 0 0 0 0 0 2011 994
"Portugal" "PTCUR0AP0000(P)" -1.1394342831883648 18486 0 0 0 0 0 0 0 0 0 2010 670
"Portugal" "PTGPA0AP0007(P)" -1.1332614240812837 19219 0 0 0 0 0 0 0 0 0 2012 1192
"Portugal" "PTCDU0AE0003(P)" -1.126648720891393 18443 0 0 0 0 0 0 0 0 0 2010 640
"Italy" "IT0005187940(P)" -1.123305172261155 19236 0 0 0 0 0 0 0 0 0 2012 1205
COMMANDS:
gen day_cnt = _n
gen target_day = day_cnt if date==18392
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>=-10 & evday<=20
gen est_window=1 if evday<=-11 & evday>=-220
drop if evt_window==. & est_window==.
qui reg delta_log_price if est_window==1
gen rmse = e(rmse)
predict phat
gen ar = delta_log_price - phat if evt_window==1
drop phat
drop if evt_window==0
egen car = sum(ar)
gen tstat = car/(rmse*sqrt(_N))
sum car tstat
Comment