I want to determine the order of AR and MA in an ARFIMA model but when I run it at the end I face the problem of " For statement unterminated in "FOR !R=1 TO 11" !!! I want to know why it's going to be like that? And, how to get rid of it ....
Thank you very much
Code: Select all
scalar m=10 'ar
scalar n=10 'ma
series function=r_total_index
matrix (m+1,n+1) A
matrix (m+1,n+1) B
ls function c
matrix A(1,1) = @AIC
matrix B(1,1) = @SC
%ma="" 'ar=0 just ma
for !j = 1 to n
%ma=%ma+"ma("+@str(!j)+")"
ls function c %ma
matrix A(1,!j+1) = @AIC
matrix B(1,!j+1) = @SC
next
%ar="" 'ma=0 just ar
for !i = 1 to m
%ar=%ar+"ar("+@str(!i)+")"
ls function c %ar
matrix A(!i+1,1) = @AIC
matrix B(!i+1,1) = @SC
next
for !i = 1 to m
for !j = 1 to n
%ma=""
%ar=""
for !k=1 to !j
%ma=%ma+"ma("+@str(!k)+")"
next
for !d=1 to !i
%ar=%ar+"ar("+@str(!d)+")"
next
ls function c %ar %ma
matrix A(!i+1,!j+1) = @AIC
matrix B(!i+1,!j+1) = @SC
next
next
scalar a_min=@min(a)
scalar b_min=@min(b)
for !r=1 to 11
for !c=1 to 11
if B(!r,!c) = b_min then
scalar qbsc=!c
scalar pbsc=!r
endif
next
next
for !r=1 to 11
for !c=1 to 11
if A(!r,!c)=a_min then
scalar qaaic=!c
scalar paaic=!r
endif
next
