Correlated shocks and impulse response functions

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Correlated shocks and impulse response functions

Postby Niklas » Thu May 06, 2010 10:53 pm

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
Niklas
 
Posts: 29
Joined: Thu May 06, 2010 10:30 pm

Re: Correlated shocks and impulse response functions

Postby jpfeifer » Fri May 07, 2010 6:41 am

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
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Correlated shocks and impulse response functions

Postby Niklas » Fri May 07, 2010 8:17 am

Hi Johannes,
that helped, thanks!
Niklas
 
Posts: 29
Joined: Thu May 06, 2010 10:30 pm

Re: Correlated shocks and impulse response functions

Postby StephaneAdjemian » Fri May 07, 2010 8:37 am

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.
Stéphane Adjemian
Université du Maine, GAINS and DynareTeam
https://stepan.adjemian.eu
StephaneAdjemian
 
Posts: 429
Joined: Wed Jan 05, 2005 4:24 pm
Location: Paris, France.

Re: Correlated shocks and impulse response functions

Postby frankcw » Sun Nov 20, 2011 6:14 pm

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
frankcw
 
Posts: 11
Joined: Tue Jul 27, 2010 2:25 pm

Re: Correlated shocks and impulse response functions

Postby jpfeifer » Sun Nov 20, 2011 7:29 pm

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Correlated shocks and impulse response functions

Postby frankcw » Tue Nov 22, 2011 2:34 am

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.
frankcw
 
Posts: 11
Joined: Tue Jul 27, 2010 2:25 pm

Re: Correlated shocks and impulse response functions

Postby jpfeifer » Tue Nov 22, 2011 7:06 am

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Correlated shocks and impulse response functions

Postby mxecon » Wed Aug 06, 2014 5:01 pm

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.
mxecon
 
Posts: 2
Joined: Wed Aug 06, 2014 4:42 pm

Re: Correlated shocks and impulse response functions

Postby jpfeifer » Thu Aug 07, 2014 2:28 pm

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).
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Correlated shocks and impulse response functions

Postby mxecon » Sat Aug 16, 2014 11:08 am

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!
mxecon
 
Posts: 2
Joined: Wed Aug 06, 2014 4:42 pm

Re: Correlated shocks and impulse response functions

Postby ZBCPA » Thu Nov 10, 2016 8:43 am

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?
ZBCPA
 
Posts: 101
Joined: Sat May 16, 2015 4:15 am

Re: Correlated shocks and impulse response functions

Postby jpfeifer » Thu Nov 10, 2016 9:08 am

Yes, because a shock to e, the first declared one, also moves u, but not the other way round
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 5 guests