Counterfactual scenarios


Do you know if there is a Dynare command or procedure to do counterfactual scenarios like the one presented in pages 36-38 of the attached paper? The authors substitute zero values for some selected estimated shocks during a given period and then conduct unconditional forecasts.

I will appreciate so much any help.


Brzoza-Brzezina & Makarski.pdf (1.71 MB)

You need to first use the shock_decomposition command, which will give you both the initial conditions and the historical shocks. Then, you need to use the simult_-function. You start at the initial values and simulate with the shock series until the point where you set all shocks except for the one you want to consider to 0.

Thanks, Professor Pfeifer.
I am looking for this command in the Dynare manual and I dont find it.
Is there a web page of link where I can see this command’s options.
Thanks in advance,

There is an example on how to use simult_ here:

Professor Johannes,

First of all, thanks for your response.

I had a look to the code posted in the link you provided before. However, I had some questions regarding the simul_ command. As you say, the shock decomposition command gives us the smoothed shocks, together with the smoothed variables, which are the summation of the smoothed shocks and the “initial conditions”.

Considering that last statement, my question is: can I replicate the smoothed (and observable) variables’ paths if the simul_’s third input (ex_) is the smoothed shocks matrix generated by the shock decomposition exercise?

I am asking this, because** simul_** does not use all the initial values given by the shock decomposition command (the first simul_’s input is just a vector n*1, where n is the number of endogenous variables plus auxiliary variables for lags and leads).

Sorry if I misunderstood something you say in your last replay.

Many thanks in advance for your help,


Sorry, I was wrong. You need the calib_smoother to extract the smoothed shocks.

Hi Professor Johannes,

I have to produce a counterfactual scenarios like the one faced by Lin.

I have already plot the historical composition of GDP (endogenous variable), based on 10 shocks considered in my DSGE model. Now, I want to remove the effect of one shock from historical decomposition and study what happens. Where can I find an example that shows how to use the calib_smoother function after the shock decomposition?


The historical decomposition relies on a linear model. In this case, the effect of shocks is linear as well. So if you want to remove the effect of one shock, you can simply use the results stored in oo_.shock_decomposition and sum up the effect of the shocks you need. See the manual for the ordering in that array.