Dear All,
I have the following equation which is a standard time series analysis where I am trying to replace the highest R-Squared with the lowest AIC....
Can you comment on how I replace the code?
Please not all the variables have been loaded in the loop. Happy to give details as required.
My effort below...
Giles
I have the following equation which is a standard time series analysis where I am trying to replace the highest R-Squared with the lowest AIC....
Can you comment on how I replace the code?
Please not all the variables have been loaded in the loop. Happy to give details as required.
Code:
foreach var of local lvif { `idf' `var' if( e(r2) > `r2'){ local r2=e(r2) local iidf "`idf' `var'" } }
Code:
scalar lowest_aic = c(maxdouble) foreach var of local lvif { `idf' `var' estat ic matrix S =r(S) scalar aic = S[1, 5] if aic < lowest_aic { local result "`idf'`var'" scalar lowest_aic = aic } }
Comment