## 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

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) hsequation eqfor !i=1 to 20eq.ls y AR(!i)hs(!i) = eq.@aicnext`

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: 12460
Joined: Tue Sep 16, 2008 5:38 pm

### Re: Regressing AR(x) model

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) hsequation eqfor !i=1 to 20%regs=""for !j=1 to !i%regs = %regs + "ar(" + @str(!j) + ") "nexteq.ls y {%regs}hs(!i) = eq.@aicnext`

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

Thank you!