Ewise

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
user_123
Posts: 4
Joined: Mon Jan 03, 2011 5:12 am

Ewise

Unread post by user_123 »

Dear users,

Im not sure about the last part [j-(j>i)] of this code:

ewise a(i,j)=%if(i==j,1.0,ap(i,j-(j>i)))

does this mean the following?:

if the elements of matrix (ap) are= a11 a12
a21 a22
a31 a32

and the elements of the matrix (a) are= b11 b12 b13
b21 b22 b23
b31 b32 b33

the b11=b22=b33=1
and b12= a11, b13=a12, b21=a21, b23=a22, b31=a31, b32=a32

Thank you in advance.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Ewise

Unread post by TomDoan »

Suppose that you have a 3x3 matrix of parameters, but that the diagonal elements are fixed at 1 while the others are free. In effect, you have a 3 x 2 matrix of free parameters which needs to get expanded for use. That's what the EWISE does. From a 3x2 matrix, it creates a 3x3 matrix, inserting the 1's in the diagonal positions. It's probably easier to think about the reverse mapping; the matrix

1 a12 a13
a21 1 a23
a31 a32 1

is parameterized using

a12 a13
a21 a23
a31 a32
user_123
Posts: 4
Joined: Mon Jan 03, 2011 5:12 am

Re: Ewise

Unread post by user_123 »

Thank you very much Tom!
Post Reply