Page 1 of 1

Correlated shocks and impulse response functions

PostPosted: Thu May 06, 2010 10:53 pm
by Niklas
Hello,

I have two questions concerning correlated shocks and impulse response functions (irf).

1. Suppose I have two stationary AR(1)-processes a=rho*a(-1)+u and b=theta*b(-1)+e and corr u, e = 0. When running irf, why do I get non-zero values for variables a_e and b_u. They are really small (in the range of 10^-15), yet they are non-zero and the irf (in the range of 10^-15) looks as if b was shocked by u and a by e, respectively .
I always observe this in the case of 2nd order approximation and sometimes in the case of 1st order approximation as well.
Can somebody explain this to me?

2. Now suppose corr u,e > 0. What does this imply for my irf? I observe that b is not shocked by the standard deviation of e, but by a smaller value, a_e is zero (or almost zero) and b is shocked by a value equal to (stdderr.e * corr e,u), i.e b_u is non-zero.
Did I do something wrong?

Thanks for the help in advance,

best regards,

Niklas

Re: Correlated shocks and impulse response functions

PostPosted: Fri May 07, 2010 6:41 am
by jpfeifer
Hi Niklas,

1.) the number 10^-15 is essentially 0 for the computer. The problem are numerical inaccuracies/rounding errors in the computation process. That is the reason why Dynare only plots IRs for variables which exceed 10^(-10).

2.) If you have correlated shocks, say u and e with covariance matrix [1 , 0.5; 0.5, 1], that is their correlation is 0.5, Dynare does a Cholesky decomposition when shocking them. This means Dynare assumes a recursive ordering, with the order determined by the order of the variables in the varexo statement, say for example
Code: Select all
varexo u, e;
The Cholesky matrix corresponding to the example covariance matrix would be [1.0000 0.5000; 0 0.8660]. In the IRs, the variable that appears first in the varexo statement, u, is shocked by 1 + 0.5 (the first line of the Cholesky matrix). The second variable e is shocked by 0.886.

I hope this helps.

Regards,

Johannes

Re: Correlated shocks and impulse response functions

PostPosted: Fri May 07, 2010 8:17 am
by Niklas
Hi Johannes,
that helped, thanks!

Re: Correlated shocks and impulse response functions

PostPosted: Fri May 07, 2010 8:37 am
by StephaneAdjemian
Hi Niklas,

Note that as a consequence the impulse reponses will depend on the order of declaration of the shocks. You may prefer (I do) to not use the dynare interface for correlating shocks and instead specify the correlation pattern in the model block (for instance with common and idiosyncrasic innovations).

Best,
Stéphane.

Re: Correlated shocks and impulse response functions

PostPosted: Sun Nov 20, 2011 6:14 pm
by frankcw
Hello,

I have a question on the Johannes's reply. The Cholesky decomposition of that matrix is indeed P= [1 0.5;0,0.8660]. But the one used might not be that. My guess from learning VAR is

(P')^(-1) (lower triangular matrix) is the one we should use, since (P')^(-1) * [u,e]' is the variance we used.

(P')^(-1) = [1,0;-0.5774,1.1547]

Then, if the shock to u is 1, then it will shock e by -0.5774 alike.

Am I right?

Thanks a lot!
Frank

Re: Correlated shocks and impulse response functions

PostPosted: Sun Nov 20, 2011 7:29 pm
by jpfeifer
For a VAR, your thinking would be correct, but it is not the way Dynare handles things. If you use the toy model
Code: Select all
var a, b;
varexo e, u;
parameters rho;
rho   = 0.95;

model;
a = rho*a(-1) + e;
b = rho*b(-1) + u;
end;

shocks;
var e; stderr 1;
var u; stderr 1;
var e, u = 0.5;
end;

stoch_simul(order=1);

a shock to e moves both a by 1 and b by 0.5 corresponding to a shock of 1*e + 0.5*u, i.e. the first row of the upper triangular Cholesky matrix. A shock to u only moves b by 0.8660, corresponding to the second row of the upper triangular Cholesky matrix.

Re: Correlated shocks and impulse response functions

PostPosted: Tue Nov 22, 2011 2:34 am
by frankcw
Thanks a lot! May I ask you one more question? The shock you talk about are shock 1 to e and 1 to u respectively?

Thanks again!

jpfeifer wrote:For a VAR, your thinking would be correct, but it is not the way Dynare handles things. If you use the toy model
Code: Select all
var a, b;
varexo e, u;
parameters rho;
rho   = 0.95;

model;
a = rho*a(-1) + e;
b = rho*b(-1) + u;
end;

shocks;
var e; stderr 1;
var u; stderr 1;
var e, u = 0.5;
end;

stoch_simul(order=1);

a shock to e moves both a by 1 and b by 0.5 corresponding to a shock of 1*e + 0.5*u, i.e. the first row of the upper triangular Cholesky matrix. A shock to u only moves b by 0.8660, corresponding to the second row of the upper triangular Cholesky matrix.

Re: Correlated shocks and impulse response functions

PostPosted: Tue Nov 22, 2011 7:06 am
by jpfeifer
I am talking about a 1 standard deviation shock to e and a 1 standard deviation shock to u. This is the Dynare default. As I set the value of the standard deviations to 1 in the shocks-block, this corresponds to an absolute value of the shocks of 1.

Re: Correlated shocks and impulse response functions

PostPosted: Wed Aug 06, 2014 5:01 pm
by mxecon
Dear all,

Sorry to bump this old post up, but it's exactly related to my issue. I am trying to use Stéphane's method to deal with correlated shocks so that I get similar impulse responses, whatever the order in which I declare them.

So basically, I had e1, e2 two correlated shocks, to which I want the impulse responses. And I transformed them as follows:
Code: Select all
e1 = u12 + u1;
e2 = gamma12*u12 + u2;

where u12, u1 and u2 are now exogenous, uncorrelated shocks, e1 and e2 are endogenous var, and I choose the gamma and the variances so that it matches the initial variances I wanted.

e1 and e2 are then used in the following processes:
Code: Select all
z1 = rho1*z1(-1) + e1;
z2 = rho2*z2(-1) + e2;


That works. But my problem is, how could I now recover IRFs of z1, z2 (and other endog variables) to e1, e2, and NOT to u1, u2, u12, as Dynare provides? The idea would be that a shock to e1 <=> shocks to u1 & u12 combined, and similarly for e2. Do you think this is possible at all? I read a few threads where you, Johannes, explain that we can sometimes define a "common shock" and that can do the trick to gather shocks, but I don't really see how to apply this here.

If I don't find a solution to that, I'll just generate IRFs to e1, e2 declaring them first in this order, and second, in the inverse order. My goal is simply to get "similar" (or symmetric rather) IRFs.

I may also very well completely miss a point as I'm fairly new to Dynare. Any thoughts?

Thanks a lot,
Maxime.

Re: Correlated shocks and impulse response functions

PostPosted: Thu Aug 07, 2014 2:28 pm
by jpfeifer
If you are using a first order approximation, the easiest thing is to make use of the linearity of the model. Just generate IRFs to the respective fundamental shocks u1, u2, and u12. The shock to e1 that you want is then simply the sum of the irfs to u12 and u1 (this is exactly what Dynare would be doing internally if you would use its interface).

Re: Correlated shocks and impulse response functions

PostPosted: Sat Aug 16, 2014 11:08 am
by mxecon
Thank you for your reply Johannes, and sorry for my late answer.

Unfortunately I'm doing a third-order approximation. I'll just switch around the order in which I declare the shocks for now, and see if I can come up with another solution later. I use mainly the simulated data to compute my own moments anyway.

Still, I'll be happy to hear any other suggestion. Thank you again!

Re: Correlated shocks and impulse response functions

PostPosted: Thu Nov 10, 2016 8:43 am
by ZBCPA
jpfeifer wrote:For a VAR, your thinking would be correct, but it is not the way Dynare handles things. If you use the toy model
Code: Select all
var a, b;
varexo e, u;
parameters rho;
rho   = 0.95;

model;
a = rho*a(-1) + e;
b = rho*b(-1) + u;
end;

shocks;
var e; stderr 1;
var u; stderr 1;
var e, u = 0.5;
end;

stoch_simul(order=1);

a shock to e moves both a by 1 and b by 0.5 corresponding to a shock of 1*e + 0.5*u, i.e. the first row of the upper triangular Cholesky matrix. A shock to u only moves b by 0.8660, corresponding to the second row of the upper triangular Cholesky matrix.


Dear Johannes,
By that you mean, all comovement of the two shocks is caused by the shock ordered First , shock e. Right?

Re: Correlated shocks and impulse response functions

PostPosted: Thu Nov 10, 2016 9:08 am
by jpfeifer
Yes, because a shock to e, the first declared one, also moves u, but not the other way round