Correlated shocks and impulse response functions

Hello,

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

  1. Suppose I have two stationary AR(1)-processes a=rhoa(-1)+u and b=thetab(-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

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

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

Hi Johannes,
that helped, thanks!

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.

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) * ’ 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

For a VAR, your thinking would be correct, but it is not the way Dynare handles things. If you use the toy model

[code]var a, b;
varexo e, u;
parameters rho;
rho = 0.95;

model;
a = rhoa(-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);
[/code]
a shock to e moves both a by 1 and b by 0.5 corresponding to a shock of 1e + 0.5u, 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.

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!

[quote=“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]var a, b;
varexo e, u;
parameters rho;
rho = 0.95;

model;
a = rhoa(-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);
[/code]
a shock to e moves both a by 1 and b by 0.5 corresponding to a shock of 1e + 0.5u, 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.[/quote]

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.

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:

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:

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.

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).

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!

[quote=“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]var a, b;
varexo e, u;
parameters rho;
rho = 0.95;

model;
a = rhoa(-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);
[/code]
a shock to e moves both a by 1 and b by 0.5 corresponding to a shock of 1e + 0.5u, 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.[/quote]

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

Yes, because a shock to e, the first declared one, also moves u, but not the other way round

Dear all,

I apologize in advance for asking a question in this old post but I think it is related to my issue.

I am working with a standard BKK model (international RBC model) with 2 countries and 2 agents in each country. I have 4 idiosyncratic shocks to productivity : one for each agent in each country (code is attached)

I want to specify negative correlations between these shocks but I get this error:

MATRIX OF COVARIANCE OF EXOGENOUS SHOCKS
Variables eps_z1h eps_z2h eps_z1f eps_z2f
eps_z1h 1.000000 -0.500000 0.250000 0.250000
eps_z2h -0.500000 1.000000 0.250000 0.250000
eps_z1f 0.250000 0.250000 1.000000 -0.500000
eps_z2f 0.250000 0.250000 -0.500000 1.000000BKK_1992.mod (3.3 KB)

"Error using chol
Matrix must be positive definite.

Error in simult (line 77)
chol_S = chol(DynareModel.Sigma_e(i_exo_var,i_exo_var))"

Thank you very much.
Emilio

Please do not double-post. See Correlated shocks