Mixing shocks & forecast: question

Dear all,
I am trying to mix deterministic and stochastic shocks and use the forecast command, as suggested in the user guide.

I have one question:
To understand exactly what happens, I set the deterministic shock to zero (and order 1 approximation):

Then, the forecast of the variable is the steady-state value of the variable all the time (it seems that’s not the case anymore for the 2nd order approximation). I would expect the value of the IRF (since I only have a stochastic shock).
In this case, dynare uses forecst and simult_ (instead of forecast and simultxdet), but I do not see the exact difference between the two sets of codes.

So, my question is: what does the command forecast do? How to interpret the output?

I attach the codes.

Thanks a lot,
temp.zip (7.14 KB)


I think it is because you simply don’t trigger the shock. You put the value zero for “eps_em” in the “shocks” block. And since you did not mention this variable in the “initval” block, this is also the steady state value of that variable. So I’m not surprised you don’t get any action. Try to put a different value for the shock to see if you get something.


Hi Sebastien,
thanks a lot for your time.

I still have one clarification question… I do not understand exactly what “forecast” does. I mean: I thought that it computes the path of the variables in response to the stochastic shock (varexo), conditional to the deterministic path of one particular variable that we set (varexo_det).

I checked more precisely the dynare codes:

  • For order=1, I saw that the forecast path of the variables is identical, whatever the nature of the shock and its size. This is due to the fact that in simultxdet.m, the vector of stochastic shock is always zero (ex(i-ykmin,:)’) in

y_(dr.order_var,i) = dr.ys(dr.order_var)+dr.ghxtempx+dr.ghuex(i-ykmin,:)’;

  • For order=2, the forecast path depends on the volatility of the shock through dr.ghs2/2 in
    y_(dr.order_var,i) = dr.ys(dr.order_var)+dr.ghs2/2+dr.ghxtempx+ dr.ghutempu+0.5*(dr.ghxxtempxx+dr.ghuutempuu)+dr.ghxu*tempxu;
    which is the shift effect if I am right.

So, at the end of the day, what forecast does exactly? (does it compute the path of variables, conditional to the path of the deterministic variable, independantly of the stochastic shock?) And, why forecast is used for “mixing” shock?
I post an example of the code (small model) that I used to obtain these results.

Thanks again for your help, that’s very useful to me.
MAIN_model_path.m (2.2 KB)
model_NK_forecast.mod (2.7 KB)

There are two cases, depending on whether “varexo_det” variables are declared or not.

In a stochastic setup, a “varexo_det” is a “deterministic exogenous”, i.e. a variable whose future path is fully and perfectly anticipated by the agents (without any uncertainty at all). This type of variable is different from classical “varexo” shocks, whose probability distribution is only known by the agents.

The use of “varexo_det” is relatively special and I am not even sure that a paper documents how Dynare computes the solution in that case (it is a mix of rational expectations and perfect foresight solution). In that case, Dynare will indeed compute the path of variables, conditional to the path of the deterministic variable, assuming that stochastic shocks are zero.

If you want to stick to a pure rational expectations model, you should not use “varexo_det”, and the forecast is done on the assumption that all future shocks are zero (the starting point is given in “histval” block). If you want to have non-zero realizations for the future shocks, you need to program a little bit (Dynare does not provide a user interface for doing this), using the “simult_.m” function (it is quite easy to use, I think there are examples on the forum).

Note that there also exist a “conditional_forecast” command, which computes a forecast given an assumption for the future path of endogenous variables. See the reference manual for documentation.

Hope this is clear enough,