AIC on all combinations

Econometrics questions and discussions
abi
Posts: 74
Joined: Sat Apr 13, 2013 3:48 am

AIC on all combinations

Unread post by abi »

Dear all,

I'm looking for a code by which RATS computes AIC on all combinations to get minimum of lags for more than two
variables. Is there any way to do it?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: AIC on all combinations

Unread post by TomDoan »

Code: Select all

*
* Based upon AKAIKE.RPF example
*
open data haversample.rat
calendar(m) 1947
data(format=rats) 1947:1 2007:4 fltg ftb3
set shortrate = ftb3
set longrate  = fltg
*
compute pmax=12,qmax=12
compute bestp=bestq=1
compute bestaic=%na
cmom
# longrate constant shortrate{1 to pmax} longrate{1 to qmax}
do p=1,pmax
   do q=1,qmax
      linreg(noprint,cmom) longrate
      # constant shortrate{1 to p} longrate{1 to q}
      @regcrits(noprint)
      if .not.%valid(bestaic).or.%aic<bestaic
         compute bestp=p,bestq=q,bestaic=%aic
   end do q
end do p
disp "Minimum AIC Lags" "p=" bestp "q=" bestq
abi
Posts: 74
Joined: Sat Apr 13, 2013 3:48 am

Re: AIC on all combinations

Unread post by abi »

Well done, Tom.

Does it possible to use it as an option in LINREG instruction?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: AIC on all combinations

Unread post by TomDoan »

abi wrote:Well done, Tom.

Does it possible to use it as an option in LINREG instruction?
No. LINREG does estimation for a fixed set of regressors. STWISE is designed for selecting the regressors using some systematic approach, but it wouldn't do multiple lag length selections---that's way too specific an application for a general purpose instruction.
Post Reply