Page 1 of 1

Colplace out of range error

Posted: Mon Oct 24, 2016 5:55 pm
by MAK
I want to estimate the betas for the three stock using rolling regression with window of 36 (months) and step size of 12 (months). I am getting the following error when I run the code.

Matrix-Vector is out of range in "Colplace(coefmat1,eq1.@coefs,13)".

for !i=1 to 3
!window = 36
!step = 12
!length = @obsrange
equation eq1
!nrolls = @round((!length-!window)/!step)
matrix(6,!nrolls) mastermat
matrix(2,!nrolls) coefmat!i
!j= 0
for !j=1 to !length-!window+1-!step step !step
smpl @first+!j @first+!j+!window-1
equation eq1.ls(options) r!i c mrp
colplace(coefmat!i,eq1.@coefs,!j)
next
matplace(mastermat, coefmat!i, 1,1)
next

Re: Colplace out of range error

Posted: Mon Oct 24, 2016 7:16 pm
by EViews Gareth
The first time through the inner loop, !j=1, and you assign the equation's coefs into the !jth column (i.e. the 1st column). All is good.

The second time through the inner loop, !j=1+!step = 13. You try to assign the equation's coefs into the !jth column again, but there is no 13th column. All is bad.

You'll have to figure out the correct column you want to put it into.

Re: Colplace out of range error

Posted: Tue Oct 25, 2016 3:57 pm
by MAK
Thanks Gareth. It works fine with step size set to 1. however, when I set the step size to 12, then it gives the message. I am a bit lost as I am new to Eviews programming. Please help me with this. I have attached the sample file above.