I am trying to run a regression among 220 firms from 1998-2018 to predict a yearly beta value. However, when I try to run the code I first get the error no observations due to not all firms having observations every year due to bankruptcies and so on. Then when I try to suppress this error using capture, which is a function I have never used before, I get the error "last estimates not found". Can someone explain to me where this error arises and possibly suggest an improvement to my current code? My current code looks like this:
Code:
forvalues i=1/220 { forvalues j=1998/2018 { capture reg ret ewretd if fakeID==`i' & estimationwindow==1 & fyear == `j' predict R_hat_`i' if fakeID==`i' & eventwindow==1 & fyear == `j', xb replace R_hat = R_hat_`i' if fakeID==`i' & fyear == `j' drop R_hat_`i' replace sigmahat=e(rmse) if fakeID==`i' & tau==0 & fyear == `j' } }
0 Response to Error last estimates not found.
Post a Comment