Contributions of shocks to endogenous variables

Dear all,

I would like to calculate the contributions of estimated shocks to endogenous variables.

I have estimated a DSGE model with Bayesian techniques and have retrieved the shocks (my model has 4 shocks), but now I want to calculate the contribution of each shock to the historical growth of an endogenous variable, eg. output, so that I can say how they explain the historical behaviour of this variable.

How can I do that with Dynare?

What I thought is that if I include the 4 shocks as exogenous deterministic shocks and run a forecast, I should get the historical behaviour of this variable. Then if I do this for one shock at a time, I would get the behaviour of output if only that shock was present, and from that I can calculate the contributions.

The problem is that dynare only allows to do this if we have at least one stochastic shock, but then my contributions will be wrong since they will mix the impact of the deterministic exogenous shock and of the stochastic shock.

Should I trick dynare by including a stochastic shock that is irrelevant for the solution? Should I use “simul” instead?
Any other ideas?



Hi Pablo,

There might be better ways of doing this, but this should work.

You have to replace the simult file in the dynare directory with the attached file, declare the EPSILON variable as a global variable in your mod file (see first lines of the mod example attached), and simulate your economy using stoch_simul. In the mod file, you have to set the EPSILON variable equal to your estimated innovations (it should have rows equal to the number of periods, and columns equal to the number of shocks). When you simulate your model, if the EPSILON variable exists, the innovations are taken from your estimated shocks. Then, if you want to shut off some shocks, simply set to zero the corresponding columns of the matrix EPSILON.

Let me know if this works. The attached example should give you an idea.

Matteo (1.43 KB)

The modern answer would be: use the


How can I combine deterministic and stochastic shocks with shock_decomposition comand?

Unfortunately, that is not yet supported.

Is there any second best solution? Something like declare the deterministic shock as stochastic and determine some process the simulates a deterministic path?

Thank you for your help

You should be able to make use of the equivalence of deterministic shocks and news shocks at first order. Define news shocks of the required anticipation horizon. Then define an auxiliary endogenous variable equal to that exogenous shock and make it observed. That should do the trick.

Thank you very much!!!

Where can I consult the equivalence between deterministic and news shocks at first order?

This seems to be a bit like the folk theorem: common knowledge without a proper source to refer to. I can only point you to an example: