On Wed, 25 Apr 2012, Henrique Andrade wrote:

> So I need to make some modifications in my Hansl code. Please look at this
> small code:
>
> <hansl>
> function list testarima (series y, int p[1:12:2], int q[1:12:2])
>    list Forecasts = null
>    loop P=1..p
>        loop Q=1..q
>            arima P 1 Q ; y --nc --quiet
>            series dummy_mais = misszero(($uhat >= +2*sd($uhat)))
>            series dummy_menos = misszero(($uhat <= -2*sd($uhat)))
>            arima P 1 Q ; y dummy_mais dummy_menos --nc --quiet
>            matrix teste_t = $coeff./$stderr
>            matrix roots = $["roots"]
>            if abs(teste_t)>critical(t, $T, 0.025) && abs(roots[,1])>1
>                arima P 1 Q ; y --nc
>                fcast Y_hat_$P_1_$Q
>                list Forecasts += Y_hat_$P_1_$Q
>                print Forecasts --byobs
>            endif
>        endloop
>    endloop
>    return Forecasts
> end function
>
> open fedstl.bin
> data exbzus exchus
> dataset addobs 12
> list Lista = testarima(exchus)
> print Lista --byobs
> </hansl>
>
> The problem now is that my function only prints the forecasts but doesn't
> store them appropriately inside the list "Projecoes".

Are you sure? If I run the script exactly as copied from above, the 
final command, "print Lista --byobs", prints three series returned 
in Lista by your function, namely Y_hat_1_1_1, Y_hat_1_1_2 and 
Y_hat_2_1_1. (I don't know anything about "Projecoes" since that 
does not appear anywhere in the script.)

Allin Cottrell

Reply via email to