Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Replacing R Squared with AIC

    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.

    Code:
    foreach var of local lvif {
      `idf' `var'
      if( e(r2) > `r2'){
        local r2=e(r2)
        local iidf "`idf' `var'"
        }
    }
    My effort below...

    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
      }
    }
    Giles

  • #2
    And your question is....?

    Comment

    Working...
    X