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?

Thanks!

In principle, you should be able to use the conditional_forecast-command. Use the TFP shock to control output in every period. See https://git.dynare.org/Dynare/dynare/blob/master/tests/conditional_forecasts/1/fs2000_cal.mod
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.

Best,
Stéphane.

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

In principle, you should be able to use the conditional_forecast -command. Use the TFP shock to control output in every period. See https://git.dynare.org/Dynare/dynare/blob/master/tests/conditional_forecasts/1/fs2000_cal.mod
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.

Hello Leonardo,

Have you tried using the conditional_forecast-command yet? I’ve been also searching for the valid examples of examining the IRFs of the model (will start a new topic if I fail to find).

Regards,
Renee

Hi Renee,
Unfortunately I wasn’t able to do what I wanted with the command so I had to temporarily stop the project to focus on another approach; I might come back to that in the future when I’ll study Dynare more in depth.

Regards,
Leonardo