Looping in an optimal policy setting

Dear all,

I wanted to know how to loop over a parameter while using optimal monetary policy. For example, consider Gali_2015_chapter_4.mod kindly provided by Johannes on Github (DSGE_mod/Gali_2015_chapter_4.mod at master · JohannesPfeifer/DSGE_mod · GitHub). Let us say I want to do the same analysis as Table 4.1 in Gali’s book but instead of a simple interest rate rule I want so see how variances and losses vary due to a parameter while monetary policy is Ramsey or discretionary.

The only thing I would need to adapt in the mod file above should be the bit of code in lines 224-239, such as
[info, oo_, options_] = stoch_simul(M_, options_, oo_, var_list_); %loop over stoch_simul

How can I do this?

Thank you

The Ramsey-part is easy. After defining the planner_objective and using the ramsey_model-statement, no further change should be necessary (except for the approximation order).

Thank you for the prompt reply. Is it the same with discretion?

No, that one is a bit more complicated. You need to replace the call to stoch_simul by

[info, oo_, options_, M_] = discretionary_policy(M_, options_, oo_, var_list_)

Thank you for this. It’s what I’d tried earlier but does not seem to work. I get the following error message:

‘Error using discretionary_policy
Too many input arguments.’
Gali_2015_chapter_4_2022.mod (14.8 KB)

I’m attaching the file for replication. It’s essentially the same as your Github file but commented out the interest rate rule so that the optimal policy could be calculated (also included a loss function whose value is unimportant).

Are you using Dynare 5.0? The following mostly works (except for the not yet modified parts)
Gali_2015_chapter_4_2022.mod (14.8 KB)

Silly me, I was using Dynare 4.5. I modified the code as needed and it now works. Thank you very much.