Partial Equilibrium Analysis in Dynare

Dear all,

Let’s suppose that I have a model with several shocks and a standard Taylor rule, and I would like to simulate the model (or get IRFs) in a setting where the nominal interest rate does not react to one particular shock in my model. This way, I can analyze the effects of this particular shock under fixed interest rates while ensuring that the Taylor principle is satisfied (because monetary policy reacts to the rest of shocks).

An example of this is Nakamura and Steinsson 2014. They are interested on studying the government spending multiplier under a Taylor rule, fixed real rates, and fixed nominal rates.

I wonder if one can do this in Dynare without the need of log-linearizing the model by hand, i.e. just working in levels as usual, and with small changes to the code that one would use with a standard Taylor rule.

What the authors of that paper do (Appendix A) is to log-linearize, by hand, impose this restrictions, find the policy functions and get the interest rate rule that satisfies this (where the particular shock would enter on the taylor rule in a linear way, undoing the effect). I wonder if this could directly be done in Dynare, either:

  • By somehow imposing this restriction on the policy function in such a way that Dynare takes this restriction into account when implementing the method of undetermined coefficients.
  • Using macros.
  • Or taking advantage of the zero lower bound literature, perhaps with the use of news shocks?

I have a different model from this paper, which is simpler and national, but the same principle applies.

Thanks indeed.

nakamura-steinsson-2014-fiscal-stimulus-in-a-monetary-union-evidence-from-us-regions.pdf (841.1 KB)
fiscalAppendix.pdf (322.5 KB)

It seems like you should add a Taylor rule like their equation (11) in the paper and then use a solver to find the feedback coefficient that makes the interest rate not react to the shock.

Thank you very much, Professor Pfeifer, this is a very simple and effective way to analyze the effect of a shock under different monetary policy regimes or under fixed nominal interest rates.

I wonder, can this solver be implemented within Dynare? the feedback coefficient is going to be a function of the parameters of the model, but I would just need to find it numerically every time that I simulate the model for a given set of parameters. Can Dynare directly solve for it numerically given our set of parameters? Which functions would you recommend me to explore?

Thanks indeed, this is extremely helpful and I really appreciate it.

One can do this in Dynare along the lines of the optimizer in DSGE_mod/RBC_IRF_matching at master · JohannesPfeifer/DSGE_mod · GitHub

I can assist.

Thanks indeed, professor. I really appreciate this.

Professor Pfeifer,

I implemented this method and it works fantastic! I am working on an extension and came up with a problem. My extension is a model with N islands, so I will have a parameter for each island, say a_island, and I will be targeting an IRF for each island, say oo_.irfs.ghat_island_eps_g. Where ‘island’ is an index 1 to N.

My problems come in the IRF_matching file, as I am trying to introduce set_param_value in a loop of the sort:

for i=1:N

And when I try to select the IRF, as I am trying to select a set of IRFs using the ‘island’ index and create an objective function that will take the max difference across islands. I have been extensively searching for solutions in the internet and people recommend to create an array instead of indexing the parameter, but I don’t know whether creating an array of parameters in Dynare would be a good idea.

Of course I could do this just by hand, without loops, inside the IRF_matching file, but it would be interesting to keep it as a function of N to be able to change N around in different calibrations.

Do you think this is possible?

Thanks indeed,

I am not sure I entirely understand the technical issue. Can you outline in a bit more detail where exactly the problem is?

The exact problem is that when I run the loop above, Matlab doesn’t seem to be looping over the index i inside the name, so it would be doing:

set_param_value(‘a_i’, xopt(1));

and I would get an error message saying that the name a_i is not recognized. In different contexts one could use the function ‘eval’, but it is prone to problems and I don’t think it could be used with the set_param_value function.

I was just wondering whether there should be a way to do this, to tell Matlab to loop over the name too, without the need to create an array (as I guess that storing parameters as an array is unconventional in Dynare?). The other alternative would be to forget about the loop and just doing this by hand, for the given N number, which is not ideal because one would have to change this every time one changes N, but it would be totally doable.

Thanks indeed.

Ideally, you don’t use global variables as in the updated version at

and then use

for iter=1:N
    M_.params(strmatch(['a_' num2str(iter)],M_.param_names,'exact'))=xopt(iter);

Thank you very much Professor Pfeifer, this makes all sense!