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
Colplace out of range error
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
Colplace out of range error
- Attachments
-
- 3 stock sample.wf1
- (22.61 KiB) Downloaded 230 times
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Colplace out of range error
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.
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
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.
Who is online
Users browsing this forum: No registered users and 2 guests
