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
How to convert date variable to year group?I am given a list of date variables in dd/mm/yy and I would like to sort the variables out in the fo…
Regression insignificant after adding industry fixed effectsHello, I am new to this forum and i am currently writing a MSc thesis for finance. I am researching…
Need help with constraint dropped when testing for equality coefficients and joint significance of two variablesHi all, Currently, I'm doing a multiple regression, with the totalcases as the dependent variable, …
Reshaping and keeping labelsHello! As context, I'm estimating several regressions with around 900 parameters. I need to save aro…
Using omega squared after regressionDear Forum, Can I use omega squared after regression to determine effect size if my independent vari…
Subscribe to:
Post Comments (Atom)
0 Response to rewriting the code
Post a Comment