Failure at stacking two matrices....

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.
Martin
Posts: 5
Joined: Thu Oct 18, 2007 11:26 pm

Failure at stacking two matrices....

Unread post by Martin »

Trying to stack two matrices into one, but no success for days. Can anyone help me to see which part goes wrong? Thanks.

Here is my program and output:
[1] DISP TR(ALPHAORT)
0.97456 0.22411 9.39326e-04 0.00000
0.01159 -0.05039 0.00239 0.99866

[2] DISP TR(%ALPHA1)*INV(OMEGA)
6662.33384 -27012.07346 -69.40077 -7486.57001
-6401.24550 8461.91272 192.20440 -19015.56708

[3] COMP IDLEFT = || TR(ALPHAORT) | TR(%ALPHA1)*INV(OMEGA) ||
[4] COMP IDRIGHT = || TR(%ALPHA1)*GAMMA*GY | %ZEROS(%R,1) ||
[5] DISP IDLEFT
0.97456
9.39326e-04 0.00000
6662.33384
-6401.24550 8461.91272
==> I thought IDLEFT will be a 4x4 matrix. The outcome is not right.

[6] DISP IDRIGHT
-368.27392
-692.51845
0.00000
0.00000


[7] COMP SOL = INV(IDLEFT)*IDRIGHT
Can't Find Match for INV(RECTANGULAR(REAL)). Closest Match is INV(MATRIX(REAL))
## SX27. Illegal Combination of Data Types for Operation
>>>>P SOL = INV(IDLEFT)<<<<


Furthermore, if there is a variable, whenever I try to re-declare it shows
## SX1. Identifier A is Already in use as a(n) RECTANGULAR(REAL)
How do I release it and change it to a new type?
I tried RELEASE, but had no success.
moderator
Site Admin
Posts: 269
Joined: Thu Oct 19, 2006 4:33 pm

Unread post by moderator »

With Version 7, you can use the new matrix concatenation operators to stack arrays. With older versions, you need to use the %BLOCKGLUE function to do this (you can also use an EWISE command with a %IF function or COMPUTE commands inside a DO loop, but the concatenation operator or %BLOCKGLUE function are easier).

With respect to re-declaring a variable as a different type, you can't change the type of a variable within a given program or session. You would need to clear the memory (using File-Clear Program or the "Clear Program" toolbar) and start fresh.

You can re-dimension an array without clearing the memory. For example, if you have a (5,5) rectangular array, you could re-dimension it as (10,10) or (2,8), etc. You just can't change the type.
Martin
Posts: 5
Joined: Thu Oct 18, 2007 11:26 pm

Unread post by Martin »

Thank you so much. :D
Post Reply