I would like to calculate relative_all forecast accuracy and I intend to use the following code. However, it spends too much time (1 year/day). I am wondering is there any better/efficient way to do this? Thank you so much.
gen max_relative_fe_all =.
gen min_relative_fe_all =.
su fiscal_year
scalar a= r(min)
scalar b= r(max)
forvalues i= `=scalar(a)'/`=scalar(b)' {
vallist gvkey if fiscal_year ==`i'
local d=r(list)
foreach k in `d' {
vallist analys if fiscal_year ==`i' & gvkey==`k'
local c=r(list)
foreach j in `c' {
su absoluteFE if analys!=`j' & fiscal_year==`i' & gvkey==`k'
replace max_relative_fe_all=r(max) if analys==`j' & fiscal_year==`i' & gvkey==`k'
replace min_relative_fe_all=r(min) if analys==`j' & fiscal_year==`i' & gvkey==`k'
di `i'
di `j'
di `k'
}
}
}
Related Posts with rewriting the code
IVDear all, I have a question concerning a comment from a reviewer and I am not quite sure how to go …
Adding time variablesHi, I am currently working with time data. The following is the time each person spends alone on ea…
Out of Sample/Scope Prediction with CII need some help to get more details for Examples 2&3 to work (page 7 in regress postestimation …
.. …
Syntax of cross-classified multilevel modelDear Statalist, I need to analyze data with complex structures. My data set consists of individuals…
Subscribe to:
Post Comments (Atom)
0 Response to rewriting the code
Post a Comment