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
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).
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).