Page 1 of 1

increasing number of regressors

Posted: Wed Jul 03, 2013 3:37 am
by basil2013
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.

Re: increasing number of regressors

Posted: Wed Jul 03, 2013 7:58 am
by EViews Gareth

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

Re: increasing number of regressors

Posted: Wed Jul 03, 2013 8:09 am
by basil2013
That works perfect.

Thanks a lot.