Finding the shock to match Output


Good morning,

I’m trying to write a code in Dynare for which I need to find the difference between the shock in TFP that I feed the model and the hypothethical shock on TFP that would match the model’s Y with a series of observed Y.

However, I’m not sure how to find the shock on TFP (which is the only shock I have) that would match an observed Y (or minimize Y - Yobs). Given that I will put this into a loop, I would only need a way to match Y for a single period.

Do you know of any model that does something similar or have any function to suggest?



In principle, you should be able to use the conditional_forecast-command. Use the TFP shock to control output in every period. See
But that is only valid in the context of unanticipated shocks and a model solved at first order. In case of nonlinear perfect foresight simulations where all shocks are anticipated, you would indeed need to loop.


Actually, you can also use the det_cond_forecast command (see the reference manual) if non linearity matters or if the constrained path is expected.



Thanks a lot for your suggestions, I will try using these ones!