how to concatenate 2 matrix

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

lisa
Posts: 45
Joined: Thu Jul 28, 2011 3:27 pm

how to concatenate 2 matrix

Postby lisa » Thu Aug 11, 2011 10:43 am

good evening,
can any one tell me how to concatenate vertically 2 matrix in eviews?
thanks

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: how to concatenate 2 matrix

Postby EViews Glenn » Thu Aug 11, 2011 10:57 am

Unfortunately, there isn't a single operator for concatenation. :(

Create a new matrix with the appropriate size.
Use matplace to put the two matrices in the appropriate positions.

Code: Select all

matrix(10, 5) a nrnd(a) matrix(5, 5) b nrnd(b) matrix(@rows(a)+@rows(b), @columns(a)) cc matplace(cc, a, 1,1) matplace(cc, b, @rows(a)+1,1)
If you are going to need to do this a lot, we could put together an add-in that would take the two matrices, and a target matrix, and do the concatenation for you.

lisa
Posts: 45
Joined: Thu Jul 28, 2011 3:27 pm

Re: how to concatenate 2 matrix

Postby lisa » Thu Aug 11, 2011 3:35 pm

thanks a lot;
please I have another question,
I want to simulate a VAR(1) model: y(t)=(x(t),z(t))'=A*y(t-1)+u(t)
My problem is how to simulate simultaneously the 2 equations of the model because x depends on z and z depends on x
x=a11*x(-1)+a12*z(-1)+u1
z=a21*x(-1)+a22*z(-1)+u2
(I know how to simulate a model when the variable x depends only on its own lagged values)

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: how to concatenate 2 matrix

Postby EViews Glenn » Fri Aug 12, 2011 10:41 am

To simulate the series you can just use the lags as you've specified, but you'll have to do each element of the matrix multiply separately as you've done. You can't use matrix algebra in the series generation.

(I don't understand the follow reply from seniyajw...)

lisa
Posts: 45
Joined: Thu Jul 28, 2011 3:27 pm

Re: how to concatenate 2 matrix

Postby lisa » Sun Aug 14, 2011 2:36 am

I simulated the elements of the matrix A (a11,a12,a21 and a22) then I typed the model
smpl @all
series x=0
series z=0
genr u1=0.2+0.6*nrnd
genr u2=0.4*(1+nrnd)
smpl @first+1 @last
x=a11*x(-1)+a12*z(-1)+u1
z=a21*x(-1)+a22*z(-1)+u2

my problem is that when I generate the model ((I need 500 observations)), an error message appears (Overflow-Missing data generated) and only 100 observations are generated;
Please how can I get the 500 observations.

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: how to concatenate 2 matrix

Postby startz » Sun Aug 14, 2011 7:14 am

What are the values of a11, etc., in your program?

lisa
Posts: 45
Joined: Thu Jul 28, 2011 3:27 pm

Re: how to concatenate 2 matrix

Postby lisa » Sun Aug 14, 2011 9:07 am

a11,a12 a21 and a22 are random walk process.
a11=a11(-1)+v1
a12=a12(-1)+v2
a21=a21(-1)+v3
a22=a22(-1)+v4
where v1,v2,v3 and v4 are error terms generated as follow:
genr v1=0.6+(1/3)*nrnd
genr v2=0.7+(1/4)*nrnd
genr v3=0.5+0.4*nrnd
genr v4=0.2(1+nrnd)

NB:
I can change the mean and the variance of error terms vi (just I need that the vector v=(v1,v2,v3,v4)' is normally distributed where v1, v2, v3 and v4 are independent.

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: how to concatenate 2 matrix

Postby startz » Sun Aug 14, 2011 10:25 am

Your v terms have a drift, so A grows over time. As a result, x grows very quickly over time. It's possible that it's exploding, although that would surprise me some. Have you looked at a plot of those values of your x variables that are produced to see if they make sense. Finally, what version of EViews are you using and is it up to date?

But bottom line, you seem to be doing everything right. You might post your workfile and see if anyone has a clue.


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests