## Maximum Number of Regressors in OLS

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

PERRYGOGAS
Posts: 36
Joined: Sat Nov 01, 2008 12:22 pm

### Maximum Number of Regressors in OLS

What is the maximum number of regressors I can use in EVIEWS? I need to estimate a model with 750 autoregressive lags.

Thank you very much!

Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

### Re: Maximum Number of Regressors in OLS

The default size of the coefficent vector (C) is 750. However, you can always define your own coefficent vector prior to the estimation and use it instead.

PERRYGOGAS
Posts: 36
Joined: Sat Nov 01, 2008 12:22 pm

### Re: Maximum Number of Regressors in OLS

Hello and thank you! how do I specify the size?

I mean that ok I created a coefficient vector with 1000 rows named cc. But trying to estimate an OLS from Quick-Estimate Equation with 1000 regressors I still get an error message. How can I do it?

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

### Re: Maximum Number of Regressors in OLS

Unfortunately you can no longer estimate an equation by list if you want to use your own coefficient vector. You have to estimate by expression.

PERRYGOGAS
Posts: 36
Joined: Sat Nov 01, 2008 12:22 pm

### Re: Maximum Number of Regressors in OLS

EViews Gareth wrote:Unfortunately you can no longer estimate an equation by list if you want to use your own coefficient vector. You have to estimate by expression.

I have created a vector named "CC" as the alternative coef vector with 1000 rows.

Typing:

ls price c coal(-1 to 800)

I get an error message...how can I instruct eviews to use the CC coef vector and avoid this error message?

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

### Re: Maximum Number of Regressors in OLS

As I said above, you can't specify by list (which is what you're doing there). You'll need to specify by expression:

Code: Select all

`price = cc(1) + cc(2)*coal(-1) + cc(3)*coal(-2) + `

and so on. Yes this is a mighty pain if you have to write out 1000 of them.

However it isn't hard to write a program that will do it for you. See below:

Code: Select all

`create u 100000series price = nrndseries coal = nrndcoef(1001) cc%regs = ""for !i=1 to 1000   %regs = %regs + " + cc(" + @str(!i) + ")*coal(-" + @str(!i) + ")"nextequation e1.ls price=cc(1001) {%regs}`

PERRYGOGAS
Posts: 36
Joined: Sat Nov 01, 2008 12:22 pm

### Re: Maximum Number of Regressors in OLS

That is great! thank you very much!

JamesEviews
Posts: 4
Joined: Mon Nov 01, 2010 2:53 am

### Re: Maximum Number of Regressors in OLS

Greetings. Gareth, plse unpack what the mini prog is doing. I am fascinated. In particular, the loop.
Regards, James Johnson

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

### Re: Maximum Number of Regressors in OLS

The loop is just building up a string.

First iteration

Code: Select all

`%regs = "+ cc(1)*coal(-1)"`

Second iteration

Code: Select all

`%regs = %regs + "+ cc(2)*coal(-2)"`

which is

Code: Select all

`%regs = "+ cc(1)*coal(-1) + cc(2)*coal(-2)"`

and so on.

At the end %regs will be equal to

Code: Select all

`"+ cc(1)*coal(-1) + cc(2)*coal(-2) + cc(3)*coal(-2) + ........  + cc(1000)*coal(-1000)"`

I then just use that in the regression:

Code: Select all

`ls price=cc(1001) + cc(1)*coal(-1) + cc(2)*coal(-2) + cc(3)*coal(-3) + ...... + cc(1000)*coal(-1000)`

JamesEviews
Posts: 4
Joined: Mon Nov 01, 2010 2:53 am

### Re: Maximum Number of Regressors in OLS

Much thanks, Gareth. You are a good teacher. Many thanks to Perry for asking the question also.
James