Em 27 de janeiro de 2013, Henrique escreveu:
Em 25 de janeiro de 2013, Allin escreveu:
On Fri, 25 Jan 2013, Henrique Andrade wrote:
>
> > I think there's something "strange" with the special
> > accessor $["roots"]. Please take a look at the following
> > Hansl code:
> >
> > <hansl>
> > # Gretl doesn't save the "r" matrix
> > open data9-7
> > loop i = 1..2
> > arima $i 1 2 ; QNC
> > matrix r = $["roots"] # overwrites "r"
> > print r
> > endloop
>
> Yes, that sort of thing ought to work in loops, but it didn't.
> This should now be fixed in CVS and snapshots.
>
Now it is working fine. Thanks Allin!
Now it is not working anymore :-( Using the "test case" I provided
everything works:
<hansl>
open data9-7
loop i = 1..2
arima $i 1 2 ; QNC
matrix r = $["roots"] # overwrites "r"
print r
endloop
</hansl>
But with my "real world" example it doesn't:
<hansl>
open australia.gdt
logs E
ldiff E
smpl --no-missing *E
series Y = l_E
scalar max_ar_lags = 2
scalar max_ma_lags = 1
scalar dummies = 1
string Nome = "l_E"
list Projecoes = null
matrix especificacoes = {}
loop for P=0..max_ar_lags --quiet
loop for Q=0..max_ma_lags --quiet
matrix especificacoes = especificacoes | {$P, 1, $Q}
endloop
endloop
scalar linhas = rows(especificacoes)
loop j=1..linhas --quiet
scalar s_ar = especificacoes[j,1]
scalar s_i = especificacoes[j,2]
scalar s_ma = especificacoes[j,3]
if dummies = 1
arima s_ar s_i s_ma ; Y --quiet
sprintf d_up "d_up_%d_%d_%d", s_ar, s_i, s_ma
sprintf d_down "d_down_%d_%d_%d", s_ar, s_i, s_ma
series @d_up = misszero(($uhat >= +2*sd($uhat)))
series @d_down = misszero(($uhat <= -2*sd($uhat)))
arima s_ar s_i s_ma ; Y @d_up @d_down #--quiet
matrix z = $coeff./$stderr
matrix roots = $["roots"]
if abs(z)>critical(t, $T, 0.025) && abs(roots[,1])>1
sprintf Y_hat "Y_hat_%d_%d_%d", s_ar, s_i, s_ma
sprintf Nome_modelo "Arima(%d,%d,%d)", s_ar, s_i, s_ma
fcast @Y_hat
list Projecoes += @Y_hat
setinfo @Y_hat --description="Variável '@Nome' estimada via
modelo '@Nome_modelo'"
endif
else
arima s_ar s_i s_ma ; Y --quiet
endif
endloop
</hansl>
I really can not find what is going wrong :-(
Best regards,
Henrique Andrade*
*