Hi everyone, Im running a loop in Stata and found that asreg is really usefull. However, when I compare the two results, it is different, here are my code:
Using loop (traditional way):
forvalues i=1(1) 3 {
reg return market_ret if id==`i' & estimation_window==1
predict p if id==`i'
replace normal_return= p if id ==`i' & event_window==1
drop p
}
Using asreg:
bys id: asreg return market_ret, w(datenum 100) fit se
Do you know why the results are different?
Thank you a lot for your time and your help!!
Using loop (traditional way):
forvalues i=1(1) 3 {
reg return market_ret if id==`i' & estimation_window==1
predict p if id==`i'
replace normal_return= p if id ==`i' & event_window==1
drop p
}
Using asreg:
bys id: asreg return market_ret, w(datenum 100) fit se
Do you know why the results are different?
Thank you a lot for your time and your help!!