increasing number of regressors

For questions regarding programming in the EViews programming language.

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

basil2013
Posts: 7
Joined: Wed Jul 03, 2013 3:04 am

increasing number of regressors

Postby basil2013 » Wed Jul 03, 2013 3:37 am

Hi,

I have the following problem:

I have a dependent variable (series) and a number of regressors stored on the columns of a matrix. Once I have created a number of series (say 5 series se1 se2...se5) which correspond to each matrix column/regressor (as I cannot regress onto regressors which are in matrix form - if there is a way of doing so please let me know) I want to regress onto
i) se1
ii) se1 se2
iii) se 1 se2 se3 and so on

I want to specify this within a loop, thus I am looking for a way of setting 5 equations where the regressors increase from se1 to se5, for instance - see below - I am trying to specify this as it is done when including lags of a variable, but it doesn't seem to work. The loop here is crucial as the number of regressors I have is going to be possibly quite large.

equation eq
for !i=1 to 5
eq.ls dependent se(1 to {!i})
next

which I expected to be as follows:
!i = 1 : eq.ls dependent se1
!i = 2 : eq.ls dependent se1 se2
and so on...

another way I tried to approach this problem was to specify the regressors as a string where the elements that the string consists of increased from se1 to se5 but this seemed to be an even more difficult task.

Thanks in advance.

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

Re: increasing number of regressors

Postby EViews Gareth » Wed Jul 03, 2013 7:58 am

Code: Select all

for !i=1 to 5 group regs for !j=1 to !i regs.add se{!j} next equation eq{!i}.ls dependent regs delete regs next

basil2013
Posts: 7
Joined: Wed Jul 03, 2013 3:04 am

Re: increasing number of regressors

Postby basil2013 » Wed Jul 03, 2013 8:09 am

That works perfect.

Thanks a lot.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests