# 3 exogenous shocks at a time

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?

Isabel

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

Best,

Isabel

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

stoch_simul(order=1);[/code]

The modified model with c is the sum of the shock e and shock u is

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

model;
a = rhoa(-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);[/code]

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

model;
a = rhoa(-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);[/code]

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!

Got it working by

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

model;
a = rhoa(-1) + 1/2c;
b = rhob(-1) + 1/2c;
end;

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

stoch_simul(order=1);[/code]

@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]var a, b, c;
varexo d, e, f;
parameters rho xi;
rho = 0.95;
xi =0.8;

model;
a = rhoa(-1) + xi b + d;
b = rhob(-1) + xic+e;
c = rhoc(-1) + xia + f;
end;

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

stoch_simul(order=1);[/code]

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]var a, b, c;
varexo d, e, f, g;
parameters rho xi;
rho = 0.95;
xi =0.8;

model;
a = rhoa(-1) + xi b + d+1/sqrt(1^2+2^2+3^2)g;
b = rho
b(-1) + xic+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);[/code]

if I have a model like

[code]var a, b, c;
varexo d, e, f;
parameters rho xi;
rho = 0.95;
xi =0.8;

model;
a = rhoa(-1) + xi b + d+ xid(-1);
b = rho
b(-1) + xic+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);[/code]

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

[code]var a, b, c;
varexo d, e, f, gg;
parameters rho xi;
rho = 0.95;
xi =0.8;

model;
a = rhoa(-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);[/code]

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

The variable a will therefore be hit by 1, b by 2,and c by three

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.

Yes, under linearity that is true. Alternatively, you can use the simult_-function as in github.com/JohannesPfeifer/DSGE_mod/blob/master/RBC_news_shock_model/RBC_news_shock_model.mod

Thanks very much for the reply! Things seem to be running smoothly (for now)

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!

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.