mastermat and coefmat error message

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

MAK
Posts: 15
Joined: Tue Oct 11, 2016 4:30 pm

mastermat and coefmat error message

Postby MAK » Sun Oct 23, 2016 5:02 pm

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: mastermat and coefmat error message

Postby EViews Gareth » Sun Oct 23, 2016 6:27 pm

Don't have three lines using matplace. Have one line placing coefmat!i. You probably need it outside your inner loop.

MAK
Posts: 15
Joined: Tue Oct 11, 2016 4:30 pm

Re: mastermat and coefmat error message

Postby MAK » Mon Oct 24, 2016 2:21 pm

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?


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests