Regressing AR(x) model

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

hholtman
Posts: 5
Joined: Wed Nov 26, 2008 4:04 am

Regressing AR(x) model

Postby hholtman » Fri Dec 05, 2008 9:12 am

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)?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13315
Joined: Tue Sep 16, 2008 5:38 pm

Re: Regressing AR(x) model

Postby EViews Gareth » Fri Dec 05, 2008 10:24 am

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
Follow us on Twitter @IHSEViews

hholtman
Posts: 5
Joined: Wed Nov 26, 2008 4:04 am

Re: Regressing AR(x) model

Postby hholtman » Fri Dec 05, 2008 11:28 am

Thank you!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 19 guests