Help ! Overflow OLS regression
Posted: 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
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