Page 1 of 1

save ARMA root to matrix

Posted: Tue Apr 12, 2011 7:48 am
by bandita9
Hi!

I wrote a little program to estimate the best ARMA structure by SIC. But i need them to forecast. But there are a lot of nonivertible MA in the estimations.

So i wanted to save the root to a matrix. But the following command didnt work:

asd2005q3.arma (type=root, save=root)

I typed that, than just the window popped up. What should i do to get the best ARMA with invertible MA roots?

I used the following program:

wfopen K:\potencialis\adatok

for !s=29 to 62
%1 = @otod(!s)

smpl 1995q1 %1

genr dlog_fogl = dlog(fogl)
%y_nev = "dlog_fogl" ' ## Ezt az idősort modellezzük
!l = 4 ' ## Tekintett késleltetések maximuma

' ** Táblázat

%tbl_nev = %y_nev + "_arma"+ @otod(!s)
d {%tbl_nev}*
table {%tbl_nev}

{%tbl_nev}(1,1) = "ARMA modellek a " + %y_nev + " változóra"
{%tbl_nev}(2,1) = "AR"
{%tbl_nev}(2,2) = "MA"
{%tbl_nev}(2,3) = "AIC"
{%tbl_nev}(2,4) = "SIC"

!minaic = 1000000
!minsic = 1000000

' ** Dupla ciklus p-re és q-ra

for !p=0 to !l
for !q=0 to !l

statusline AR !p MA !q

%eqnev = "eq_ar"+@str(!p)+"_ma"+@str(!q)

' ** Létrehozza az MA(1) ... MA(q) szöveget

%argma=""
if !q>0 then
for !i=1 to !q
%argma=%argma+" MA("+@str(!i)+")"
next '!i
endif

' ** Létrehozza az AR(1) ... AR(p) szöveget

%argar=""
if !p>0 then
for !j=1 to !p
%argar=%argar+" AR("+@str(!j)+")"
next ' !j
endif

%arg=%y_nev + " C " + %argma + %argar

' ** Egyenlet és AIC & SIC értékek

if (!p+!q)>0 then

equation {%eqnev}.ls {%arg}

{%tbl_nev}(2+!p*(!l+1)+!q,1)=@str(!p)
{%tbl_nev}(2+!p*(!l+1)+!q,2)=@str(!q)
{%tbl_nev}(2+!p*(!l+1)+!q,3)=@aic
{%tbl_nev}(2+!p*(!l+1)+!q,4)=@schwarz

' ** AIC & SIC minimumkeresés

if @aic < !minaic then
!minaic = @aic
!p_aic = !p
!q_aic = !q
endif

if @schwarz < !minsic then
!minsic = @schwarz
!p_sic = !p
!q_sic = !q
endif


d {%eqnev}

endif

next ' !q
next ' !p

{%tbl_nev}((!l+1)^2+3,1)= "AIC szerinti legjobb: ARMA(" + @str(!p_aic) + "," + @str(!q_aic) + ")"
{%tbl_nev}((!l+1)^2+4,1)= "SIC szerinti legjobb: ARMA(" + @str(!p_sic) + "," + @str(!q_sic) + ")"

if !p_aic=2 then

%asd="asd" + @otod(!s)
equation {%asd}.ls dlog(fogl) c ar(1)

endif

%arga=""
if !q>0 then
for !i=1 to !q_aic
%arga=%arga+" MA("+@str(!i)+")"
next '!i
endif

%argr=""
if !p>0 then
for !j=1 to !p_aic
%argr=%argr+" AR("+@str(!j)+")"
next ' !j
endif

%argt=%y_nev + " C " + %arga + %argr
%asd="asd" + @otod(!s)
equation {%asd}.ls {%argt}


next

Re: save ARMA root to matrix

Posted: Tue Apr 12, 2011 7:55 am
by EViews Gareth

Code: Select all

asd2005q3.arma (type=root, save=root)
You have a space between the arma and the parenthesis.

Re: save ARMA root to matrix

Posted: Tue Apr 12, 2011 8:04 am
by bandita9
Thx!