multiplying a series by an element of a matrix

For questions regarding programming in the EViews programming language.

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

DBel2012
Posts: 69
Joined: Sun Sep 30, 2012 5:37 am

multiplying a series by an element of a matrix

Postby DBel2012 » Thu Feb 25, 2016 6:58 am

Good morning,

I need to multiply a series by an element of a matrix, For instance :

I've got a series named varY, a matrix myMat, and I want to create a new series varX which is the product of element 1 of myMat and varY.

series varX = myMat(1) * varY

The only way I can do that is if I assign myMat(1) to a scalar; scalar temp = myMat(1) and then series varX = temp * varY.

I wonder why I cannot multiply a series by an element of a matrix.

Thanks!

Danny

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

Re: multiplying a series by an element of a matrix

Postby EViews Gareth » Thu Feb 25, 2016 7:43 am

Works fine for me:

Code: Select all

create u 10 matrix(3,3) mymat mymat = 5.5 series y = 2 series varx = mymat(1,1)*y

DBel2012
Posts: 69
Joined: Sun Sep 30, 2012 5:37 am

Re: multiplying a series by an element of a matrix

Postby DBel2012 » Thu Feb 25, 2016 8:20 am

Hi,

You are right, it works perfectly.

My mistake. Since I had created a matrix with only one column, I thought I did not need to specify the column in the expression series varX = myMat(1) * varY

So, the right way is to write series varX = myMat(1,1) * varY

Thanks a lot for helping me.

Danny


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests