Hi everyone,
I've gone through the Princeton event study stata coding, everything run through (I haven't coded the test bit), but I found that my dataset does not contain the predicted return and the accumulative return. What went wrong?
sum predicted_ret cumulative_abnormal_return
Variable | obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
predicted_~n | 0
cumulative~n | 8, 214 0 0 0 0
My codes:
gen predicted_return=.
egen id=group(com_id)
forvalues i=1(1)144 { /*note: replace N with the highest value of id */
l id com\_id if id==\`i' & dif==0 reg ret mkt\_ret if id==\`i' & estimation\_window==1 predict p if id==\`i' replace predicted\_return = p if id==\`i' & event\_window3==1 drop p
}
*calculate abnormal return
sort id date
gen abnormal_return=ret-predicted_return if event_window3==1
by id: egen cumulative_abnormal_return = total(abnormal_return)
I've gone through the Princeton event study stata coding, everything run through (I haven't coded the test bit), but I found that my dataset does not contain the predicted return and the accumulative return. What went wrong?
sum predicted_ret cumulative_abnormal_return
Variable | obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
predicted_~n | 0
cumulative~n | 8, 214 0 0 0 0
My codes:
gen predicted_return=.
egen id=group(com_id)
forvalues i=1(1)144 { /*note: replace N with the highest value of id */
l id com\_id if id==\`i' & dif==0 reg ret mkt\_ret if id==\`i' & estimation\_window==1 predict p if id==\`i' replace predicted\_return = p if id==\`i' & event\_window3==1 drop p
}
*calculate abnormal return
sort id date
gen abnormal_return=ret-predicted_return if event_window3==1
by id: egen cumulative_abnormal_return = total(abnormal_return)
Comment