Page 1 of 1

Regressing AR(x) model

Posted: Fri Dec 05, 2008 9:12 am
by hholtman
I have a series y and want to regress it like an AR(x) model.
I can type "ls y AR(1) AR(2)... AR(x)"
but in programming can I do something like "ls y AR(1:x)"?
This specific notation does not work.
I hope it is clear what I want to do. I now have:

Code: Select all

vector(20) hs equation eq for !i=1 to 20 eq.ls y AR(!i) hs(!i) = eq.@aic next
How to edit this so that I obtain the @aic values for regressions on
AR(1),
AR(1) AR(2)
,...,
AR(1),...,AR(20)?

Re: Regressing AR(x) model

Posted: Fri Dec 05, 2008 10:24 am
by EViews Gareth
You'll have to use two for loops, one inner loop to build up the string with the AR terms:

Code: Select all

vector(20) hs equation eq for !i=1 to 20 %regs="" for !j=1 to !i %regs = %regs + "ar(" + @str(!j) + ") " next eq.ls y {%regs} hs(!i) = eq.@aic next

Re: Regressing AR(x) model

Posted: Fri Dec 05, 2008 11:28 am
by hholtman
Thank you!