I'm trying to patch armax. The key moment is treating of $error
Command ref. says one should use catch prefix alongside.
I tried context search for "catch" in armax.gfn and didn't find any.
Is $error behavior different in loops?
A fragment for quick reference
# begin of armax.gfn fragment
loop q = 0..maxq -q
# estimate model
if nelem(xlist)=0
if p=0 && q=0
# p,q=0 時, 一定要有 const, 不然會有參數數目不足之 error
arima p q ; y -q @eMethod
else
arima p q ; y -q @eMethod @sCons
endif
else
arima p q ; y xlist -q @eMethod @sCons
endif
err = $error
if (err)
printf "Got error %d (%s)\n", err, errmsg(err)
endif
if isnull($aic)=0
printf "Got error,p=%d,q=%d\n",p,q
else
@tabname[nrow,1] = p
@tabname[nrow,2] = q
@tabname[nrow,3] = $aic
@tabname[nrow,4] = $bic
@tabname[nrow,5] = $hqc
# test for mininum noise model
if nrow=1
min_aic = $aic
min_sc = $bic
min_hq = $hqc
order_aic = nrow
order_sc = nrow
order_hq = nrow
else
if $aic < min_aic
min_aic = $aic
order_aic = nrow
endif
if $bic < min_sc
min_sc = $bic
order_sc = nrow
endif
if $hqc < min_hq
min_hq = $hqc
order_hq = nrow
endif
endif
endif
nrow = nrow+1
endloop
# end of armax fragment