Hi, everyone,
I have encountered an issue with the user-written program -eventstudy2- which I have solved it with the help of Thomas Kaspereit, the author of the routine. At the request of Thomas, I post the solution here to help other users.
More specifically, the problem lies in the expected return computation using CAPM or other factor models which requires excess returns, i.e., returns in excess of risk-free rate. If one tries to use the following code
will get different results compared to
where
and
. Thomas figured out that the phenomenon is due to the Maynes and Rumsey (1993, JBF) alogrithm to treat missing returns and thin trading. The solution is to add on top of
this part which now lies below
. These changes should be applied in the ado file.
Also, below is a code provided by Thomas that applies returns and log-returns:
I have encountered an issue with the user-written program -eventstudy2- which I have solved it with the help of Thomas Kaspereit, the author of the routine. At the request of Thomas, I post the solution here to help other users.
More specifically, the problem lies in the expected return computation using CAPM or other factor models which requires excess returns, i.e., returns in excess of risk-free rate. If one tries to use the following code
Code:
eventstudy2 Security_id Date using Security_returns_mod if Ea > 0.05, ret(Return) car1LB(-1) car1UB(1) mod(FM) marketfile(Factor_returns) mar(MKT) idmar(Market_reference) risk(risk_free_rate) log replace
Code:
eventstudy2 Security_id Date using Security_returns_mod if Ea > 0.05, ret(excess_Return) car1LB(-1) car1UB(1) mod(FM) marketfile(Factor_returns) mar(excess_MKT) idmar(Market_reference) risk(risk_free_rate) log replace
Code:
excess_Return=Return-risk_free_rate
Code:
excess_MKT=MKT-risk_free_rate
Code:
if "`model'" == "MA" | "`model'" == "FM" | "`model'" == "RAW" | "`model'" == "COMEAN"{
foreach v in `marketreturns' `factor1' `factor2' `factor3' `factor4' `factor5' `factor6' `factor7' `factor8' `factor9' `factor10' `factor11' `factor12' `factor13' `factor14' `factor15' `riskfreerate'{
gen `cum_`v'' = `v'
by `1': replace `cum_`v'' = `cum_`v'' + `cum_`v''[_n-1] if `cum_periods' > 1 & `cum_periods' != . & `cum_`v''[_n-1] != .
replace `cum_`v'' = `cum_`v'' / sqrt(`cum_periods')
}
gen `cum_`returns'' = `returns' / sqrt(`cum_periods')
}
Code:
if "`riskfreerate'" != ""{
replace `returns' = `returns' - `riskfreerate'
replace `marketreturns' = `marketreturns' - `riskfreerate'
}
Also, below is a code provided by Thomas that applies returns and log-returns:
Code:
use "security_returns.dta", clear
gen logReturn = ln(1+Return)
preserve
keep Date
duplicates drop
set seed 1000
gen rf = uniform()/10/365
gen logrf = ln(1+rf)
save logrf, replace
restore
sort Security_id Date
merge m:1 Date using logrf, nogen
gen logReturn_minus_logrf = logReturn - logrf
sort Security_id Date
save security_returns_mod.dta, replace
use "factor_returns.dta", clear
merge m:1 Date using logrf, nogen
gen logMKT = ln(1+MKT)
gen logMKT_minus_rf = logMKT - logrf
save factor_returns_mod.dta, replace
use "earnings_surprises.dta"
eventstudy2 Security_id Date using Security_returns_mod if Ea > 0.05, ret(logReturn) car1LB(-1) car1UB(1) mod(FM) marketfile(Factor_returns_mod) mar(logMKT) idmar(Market_reference) risk(logrf) log replace
eventstudy2 Security_id Date using Security_returns_mod if Ea > 0.05, ret(logReturn_minus_logrf) car1LB(-1) car1UB(1) mod(FM) marketfile(Factor_returns_mod) mar(logMKT_minus_rf) idmar(Market_reference) log replace
