Statistical programming, matrix languages, and more

Simulate a bivariate vector follow VAR(2) structure

Reply
New Contributor
Posts: 2

Simulate a bivariate vector follow VAR(2) structure

Hi,

Can someone help me verify that the following code generate a bivariate vector "z" that follows a VAR(2) structure? The first AR matrix is

0.6  0.0

0.0  0.6

and the second AR matrix is

0.18  0.00

0.00  0.18

This vector series also has a linear time trend with coefficient vector, g =

0.3

0.5

Thanks!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PROC IML;

mean_eta  = J(1,2,0);

sigma_eta = {1.0 0.5,

                    0.5 1.0};

eta       = randnormal(300,Mean_eta,Sigma_eta);

f    ={

0.6  0.0,

0.0  0.6};

g    = {0.3, 0.5};

t    = T(do(1,300,1));

z = J(300,2,0);

do i = 3 to 300;

  z[i,] = T( f*T(z[i-1,]) + 0.3#f*T(z[i-2,]) + g*t ) + eta[i,];

end;

Quit;

Ask a Question
Discussion stats
  • 0 replies
  • 254 views
  • 0 likes
  • 1 in conversation