Help ! Overflow OLS regression

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

joko
Posts: 1
Joined: Wed Dec 23, 2015 3:49 am

Help ! Overflow OLS regression

Postby joko » Wed Dec 23, 2015 4:09 am

Hi everybody,

I want to perform 126 OLS regressions with 6 explanatory variables.
For each regression I want to stock the coefficients for each explantory variables.
The sum of each coefficients must to be equal to one.

rit is the return of a fund
lvsr, mvsr, svsr...denote indices returns

The problem is when I run the program, I obtain the folowing error message : "overflow".
Surprinsingly the program works well with 5 independant variables....

My program is the following :

for !i = 1 to 126
param c(1) .1 c(2) .1 c(3) .1 c(4) .1 c(5) .1 c(6) .1
equation eq!i.ls rit!i = (exp(c(1))/(exp(c(1))+exp(c(2))+exp(c(3))+exp(c(4))+exp(c(5))+exp(c(6))))*lvsr
+(exp(c(2))/(exp(c(1))+exp(c(2))+exp(c(3))+exp(c(4))+exp(c(5))+exp(c(6))))*mvsr
+(exp(c(3))/(exp(c(1))+exp(c(2))+exp(c(3))+exp(c(4))+exp(c(5)) +exp(c(6))))*svsr
+(exp(c(4))/(exp(c(1))+exp(c(2))+exp(c(3))+exp(c(4))+exp(c(5))+exp(c(6))))*lgsr
+(exp(c(5))/(exp(c(1))+exp(c(2))+exp(c(3))+exp(c(4))+exp(c(5))+exp(c(6))))*mgsr
+(exp(c(6))/(exp(c(1))+exp(c(2))+exp(c(3))+exp(c(4))+exp(c(5))+exp(c(6))))*sgsr

vector(126) coef1
coef1(!i) = @exp(c(1))/(@exp(c(1))+@exp(c(2))+@exp(c(3))+@exp(c(4))+@exp(c(5))+@exp(c(6)))
vector(126) coef2
coef2(!i) = @exp(c(2))/(@exp(c(1))+@exp(c(2))+@exp(c(3))+@exp(c(4))+@exp(c(5))+@exp(c(6)))
vector(126) coef3
coef3(!i) = @exp(c(3))/(@exp(c(1))+@exp(c(2))+@exp(c(3))+@exp(c(4))+@exp(c(5))+@exp(c(6)))
vector(126) coef4
coef4(!i) = @exp(c(4))/(@exp(c(1))+@exp(c(2))+@exp(c(3))+@exp(c(4))+@exp(c(5))+@exp(c(6)))
vector(126) coef5
coef5(!i) = @exp(c(5))/(@exp(c(1))+@exp(c(2))+@exp(c(3))+@exp(c(4))+@exp(c(5))+@exp(c(6)))
vector(126) coef6
coef6(!i) = @exp(c(6))/(@exp(c(1))+@exp(c(2))+@exp(c(3))+@exp(c(4))+@exp(c(5))+@exp(c(6)))
next


I hope you will have idea to resolve my problem.
Thank you so much
Joko

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Help ! Overflow OLS regression

Postby EViews Glenn » Wed Dec 23, 2015 9:54 am

I'm not quite sure that your regression is doing what you want it to do as your parameterization is not identified (note that if you double all of the coefficient values, the share ratios remain constant). My suspicion is that because of this, one or more of the C coefficient values is increasing to a point where the exp is overflowing. I'm not sure why it works with 5 variables unless you are doing something different in that case.

As in a standard multinomial logistic regression, you'll have to normalize one of the coefficients to 0 to pin down the scale.

Incidentally, since you are doing this in a program, the following should simplify things a bit and make it easier to run with different numbers of variables. I haven't tested it since I'm not in the office right now, so there probably is a syntax error, but I think you'll get the general idea. I'll double check when I get in...

Code: Select all

' save denominator string %denom = "(1+@exp(c(2))+@exp(c(3))+@exp(c(4))+@exp(c(5))+@exp(c(6)))" matrix(126, 6) coefs for !i = 1 to 126 ' initialize for this pass param c(2) .1 c(3) .1 c(4) .1 c(5) .1 c(6) .1 ' estimate equation equation eq!i.ls rit!i = 1/{%denom}*lvsr + @exp(c(2))/{%denom}*mvsr + @exp(c(3))/{%denom}*svsr + @exp(c(4))/{%denom}*lgsr + @exp(c(5)){%denom}*mgsr + @exp(c(6))/{%denom}*sgsr ' save coefficients coefs(!i, 1) = 1/{%denom} for !j = 2 to 6 coefs(!i, !j) = @exp(c(!j))/{%denom} next next for !j = 1 to 6 vector coef!j = coefs.@col(!j) next

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: Help ! Overflow OLS regression

Postby startz » Wed Dec 23, 2015 10:23 am

Following along with the basic idea of Glenn's advice, you might try replacing c(6) in everywhere in your program with (1-c(1)-c(2)-c(3)-c(4)-c(5)).

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Help ! Overflow OLS regression

Postby EViews Glenn » Wed Dec 23, 2015 11:15 am

In my example, I normalized the C(1) --> exp(C(1)) = exp(0) = 1. I'm also assuming that the original poster did want positivity so I kept the exp transforms.

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: Help ! Overflow OLS regression

Postby startz » Wed Dec 23, 2015 11:18 am

Oh, I see. I think the two normalizations are equivalent. Yours is easier to write out.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Help ! Overflow OLS regression

Postby EViews Glenn » Wed Dec 23, 2015 11:52 am

The one that I used is commonly used in the limited dependent variables world when we require that values that lie between 0 and 1 and add up to 1.

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: Help ! Overflow OLS regression

Postby startz » Wed Dec 23, 2015 11:55 am

The substitution I suggested also does as everything is an argument to exp()...I think.


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests