Page 1 of 1

mastermat and coefmat error message

Posted: Sun Oct 23, 2016 5:02 pm
by MAK
I have daily observations on stock returns and have the following written the following code. the step size is 250 so I want to get annual betas using five years daily data and am rolling one year(250 days) forward. When I run the code, it is giving me the error:

{COEFMAT2 is not defined in matplace(mastermat, coefmat2, 3,1)}

Please help me with this?

for !i=1 to 3
!window = 1250
!step = 250
!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)
matplace(mastermat, coefmat1, 1,1)
matplace(mastermat, coefmat2, 3,1)
matplace(mastermat, coefmat3, 5,1)
next
next

Re: mastermat and coefmat error message

Posted: Sun Oct 23, 2016 6:27 pm
by EViews Gareth
Don't have three lines using matplace. Have one line placing coefmat!i. You probably need it outside your inner loop.

Re: mastermat and coefmat error message

Posted: Mon Oct 24, 2016 2:21 pm
by MAK
Thanks Gareth. It does calculate the coefficients for the three stocks but if I don't give the row and column address, it only displays the coefficients for the 3rd stock only and shows 0.000 for all the coefficients of stock 1 and stock 2. Is there another short way around it as otherwise I have to write matplace(mastermat, coefmat!i, r,c) for 1200 stocks?