AIC on all combinations

Econometrics questions and discussions

AIC on all combinations

Unread postby abi » Mon Dec 07, 2020 5:15 pm

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?
abi
 
Posts: 71
Joined: Sat Apr 13, 2013 3:48 am

Re: AIC on all combinations

Unread postby TomDoan » Mon Dec 07, 2020 6:18 pm

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
TomDoan
 
Posts: 7240
Joined: Wed Nov 01, 2006 5:36 pm

Re: AIC on all combinations

Unread postby abi » Wed Dec 09, 2020 12:56 pm

Well done, Tom.

Does it possible to use it as an option in LINREG instruction?
abi
 
Posts: 71
Joined: Sat Apr 13, 2013 3:48 am

Re: AIC on all combinations

Unread postby TomDoan » Wed Dec 09, 2020 2:38 pm

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.
TomDoan
 
Posts: 7240
Joined: Wed Nov 01, 2006 5:36 pm


Return to General Econometrics

Who is online

Users browsing this forum: No registered users and 3 guests

cron