Page 1 of 1
AIC on all combinations
Posted: Mon Dec 07, 2020 4:15 pm
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?
Re: AIC on all combinations
Posted: Mon Dec 07, 2020 5:18 pm
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
Re: AIC on all combinations
Posted: Wed Dec 09, 2020 11:56 am
by abi
Well done, Tom.
Does it possible to use it as an option in LINREG instruction?
Re: AIC on all combinations
Posted: Wed Dec 09, 2020 1:38 pm
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.