Hi again,
I have been working on this a while now, it's making me a little crazy. My code yields the same output for the first time period as I get when using the built-in function, but for some reason after that it's different. I have been looking at Helmut Lütkepohl's New Introduction to Multiple Time Series Analysis and I redid his example (page 59), but the same thing isn't working for this new data. Do you have any ideas? Please tell me if you do.
Here's the code:
Code: Select all
create wf q 1990q1 2012q4
rndseed 1
series x=nrnd
series y=nrnd
series z=nrnd
VAR VAR.LS 1 1 X Y Z
VAR.IMPULSE(4, t, imp = uni)
matrix coefmat=var.@coefmat
coefmat=@subextract(coefmat, 1, 1, 3, 3)
sym residmat=var.@residcov
matrix P=@cholesky(residmat)
'P = @identity(3)
matrix theta0 = P
matrix theta1 = @transpose(coefmat * P)
matrix theta2 = @transpose(coefmat * coefmat * P)
matrix theta3 = @transpose(coefmat * coefmat * coefmat * P)
table(15, 4) responses
responses(1,1)="X"
responses(6,1)="Y"
responses(11,1)="Z"
for !shock=0 to 2
responses(1+!shock*5, 2)="X"
responses(1+!shock*5, 3)="Y"
responses(1+!shock*5, 4)="Z"
next
for !i=1 to 3
for !j=0 to 2
for !k=0 to 3
responses(2+!j*5+!k,1+!i)=theta!k(1+!j, !i)
next
next
next
show responses
Do note that my P matrix is identical to the one obtained from "var.@impfact". But how is this then used?