3 exogenous shocks at a time

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.

3 exogenous shocks at a time

Postby mcb2010 » Fri Mar 19, 2010 5:07 pm

Hi all,
I am trying to extend the model in Dynare User Guide by Schorfheide through adding a third exogenous shock (risk premium shock) in addition to the monetary and technology shocks. I would like to know if it is OK to have 3 shocks in the model in the sense that I simulate all 3 shocks at a time, in order to end up with the impulse response functions for all 3 shocks at once. While incorporating a third shock into the model, is there anything special I need to watch out, apart from the stochastic process I define for the shock?

Thanks a lot in advance.

Isabel
mcb2010
 
Posts: 2
Joined: Fri Mar 19, 2010 4:59 pm

Re: 3 exogenous shocks at a time

Postby jpfeifer » Sat Mar 20, 2010 9:57 am

Dear Isabel,

this should be no problem. However, it might be somewhat tricky to simultaneously feed all three shocks into Dynare for a single impulse response. Usually, if you define three shocks, Dynare output gives you three series of impulse responses. If you only want a single one with all three shocks at once, you have to define a fourth exogenous shocks, let's say epscommon, which you add to each of the 3 equations you want to shocks (probably with a scaling factor for differing variances). This shock can then be interpreted as entering all three of the other shocks at once. The impulse response of Dynare to this shock is the one you are looking for.

Best 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: 3 exogenous shocks at a time

Postby mcb2010 » Tue Mar 23, 2010 4:10 pm

That sounds very helpful already. Thank you very much Johannes!

Best,

Isabel
mcb2010
 
Posts: 2
Joined: Fri Mar 19, 2010 4:59 pm

Re: 3 exogenous shocks at a time

Postby xuz » Fri Apr 08, 2016 10:36 pm

hi, I read through this thread and some related treads but I still cannot get the code working. The simple model with two exogenous shocks is

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;
end;

stoch_simul(order=1);



The modified model with c is the sum of the shock e and shock u is
Code: Select all
var a, b;
varexo e, u, c;
parameters rho;
rho   = 0.95;

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

shocks;
var e; stderr 1;
var u; stderr 1;
var c; stderr 2;
end;

stoch_simul(order=1);


The error I got is "ERROR: There are 3 equations but 2 endogenous variables!"

I know why I got this error but I cannot write a correct model that gives a irf of shock c which is the sum of e and u.

If I try the following code:

Code: Select all
var a, b;
varexo u, c;
parameters rho;
rho   = 0.95;

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

shocks;
var e; stderr 1;
var u; stderr 1;
var c; stderr 2;
end;

stoch_simul(order=1);


Then I'll introduce the correlation of shock u to a. I know in this example it makes no sense to look at the sum of shocks. I just use it simple to know how to construct the sum of shocks and get the irf. Thanks!
xuz
 
Posts: 29
Joined: Thu May 14, 2015 10:59 pm

Re: 3 exogenous shocks at a time

Postby xuz » Fri Apr 08, 2016 10:46 pm

Got it working by
Code: Select all
var a, b;
varexo e, u c;
parameters rho;
rho   = 0.95;

model;
a = rho*a(-1) + 1/2*c;
b = rho*b(-1) + 1/2*c;
end;

shocks;
var e; stderr 1;
var u; stderr 1;
var c; stderr 2;
end;

stoch_simul(order=1);
xuz
 
Posts: 29
Joined: Thu May 14, 2015 10:59 pm

Re: 3 exogenous shocks at a time

Postby jpfeifer » Thu Apr 14, 2016 8:47 am

@xuz What are you trying to achieve? In your last try, e and u do not appear in the model. You are working with one shock only.
------------
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: 3 exogenous shocks at a time

Postby xuz » Sun May 01, 2016 11:55 pm

jpfeifer wrote:@xuz What are you trying to achieve? In your last try, e and u do not appear in the model. You are working with one shock only.


Professor Pfeifer , if I have a model like
Code: Select all
var a, b, c;
varexo d, e, f;
parameters rho xi;
rho   = 0.95;
xi =0.8;

model;
a = rho*a(-1) + xi* b + d;
b = rho*b(-1) + xi*c+e;
c = rho*c(-1) + xi*a + f;
end;

shocks;
var d; stderr 1;
var e; stderr 2;
var f; stderr 3;
end;

stoch_simul(order=1);


Question 1: What kind of code should I use if i want a irf for 3 shocks hitting the system at the same time? Is the following new shock g working?

Code: Select all
var a, b, c;
varexo d, e, f, g;
parameters rho xi;
rho   = 0.95;
xi =0.8;

model;
a = rho*a(-1) + xi* b + d+1/sqrt(1^2+2^2+3^2)*g;
b = rho*b(-1) + xi*c+e+2/sqrt(1^2+2^2+3^2)*g;
c = rho*c(-1) + xi*a + f+3/sqrt(1^2+2^2+3^2)*g;
end;

shocks;
var d; stderr 1;
var e; stderr 2;
var f; stderr 3;
var g; stderr sqrt(1^2+2^2+3^2);
end;

stoch_simul(order=1);


if I have a model like
Code: Select all
var a, b, c;
varexo d, e, f;
parameters rho xi;
rho   = 0.95;
xi =0.8;

model;
a = rho*a(-1) + xi* b + d+ xi*d(-1);
b = rho*b(-1) + xi*c+e;
c = rho*c(-1) + xi*a + f;
end;

shocks;
var d; stderr 1;
var e; stderr 2;
var f; stderr 3;
end;

stoch_simul(order=1);


Question 2: Is the following new shock gg working? Thanks!

Code: Select all
var a, b, c;
varexo d, e, f, gg;
parameters rho xi;
rho   = 0.95;
xi =0.8;

model;
a = rho*a(-1) + xi* b + d+1/sqrt(1^2+2^2+3^2)*gg +xi * 1/sqrt(1^2+2^2+3^2)*gg(-1);
b = rho*b(-1) + xi*c+e+2/sqrt(1^2+2^2+3^2)*gg;
c = rho*c(-1) + xi*a + f+3/sqrt(1^2+2^2+3^2)*gg;
end;

shocks;
var d; stderr 1;
var e; stderr 2;
var f; stderr 3;
var gg; stderr sqrt(1^2+2^2+3^2);
end;

stoch_simul(order=1);
xuz
 
Posts: 29
Joined: Thu May 14, 2015 10:59 pm

Re: 3 exogenous shocks at a time

Postby jpfeifer » Fri May 06, 2016 8:04 am

Without context, it is hard to see what you are after and why you have that particular form for the variance of the common shock g. But in principle adding a common shock to each of the exogenous processes is correct when you want to simultaneously shock all three of them. Dynare will do a one standard deviation shock, which is
Code: Select all
sqrt(1^2+2^2+3^2)

The variable a will therefore be hit by 1, b by 2,and c by three
------------
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: 3 exogenous shocks at a time

Postby nkscholtes » Tue Aug 02, 2016 7:54 pm

From browsing through other posts, it seems that under linearity, the proposed solution is equivalent to simply adding the IRFs associated to the three shocks. Is that correct? In which case, is it simply a case of going into the oo_ structure and adding the vectors for the IRFs associated to each endogenous variable specified in stoch_simul? Thanks in advance for your reply.
nkscholtes
 
Posts: 3
Joined: Tue Aug 02, 2016 7:50 pm

Re: 3 exogenous shocks at a time

Postby jpfeifer » Wed Aug 03, 2016 6:58 am

Yes, under linearity that is true. Alternatively, you can use the simult_-function as in https://github.com/JohannesPfeifer/DSGE_mod/blob/master/RBC_news_shock_model/RBC_news_shock_model.mod
------------
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: 3 exogenous shocks at a time

Postby nkscholtes » Thu Aug 04, 2016 11:42 am

Thanks very much for the reply! Things seem to be running smoothly (for now)
nkscholtes
 
Posts: 3
Joined: Tue Aug 02, 2016 7:50 pm

Re: 3 exogenous shocks at a time

Postby nkscholtes » Mon Aug 08, 2016 8:08 am

Out of curiosity, do you know of any references that specify this or use this method of having simultaneous shocks then adding the IRFs under linearity? It's intuitive to me but as most people provide a set of IRFS for each shock, it would help to have a reference.

As I'm fairly new to Dynare myself, I was also curious about the convention for writing the AR(1) shock processes. As far as the solver is concerned, does it make a difference if the shock is specified in multiplicative exponential form (i.e exp(error)) or additive log form? Thanks again!
nkscholtes
 
Posts: 3
Joined: Tue Aug 02, 2016 7:50 pm

Re: 3 exogenous shocks at a time

Postby jpfeifer » Mon Aug 08, 2016 12:51 pm

Linearity is such a basic property that people do not discuss it in articles. It is immediately evident by looking at linear policy functions.

It does not matter how you specify your shock process as long as it is consistent. Both specifications are mathematically equivalent.
------------
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 7 guests