Implementing unexpected permanent shocks in a model

How do I examine the IRFs of the model to shocks that are not part of the model that Dynare solves for in the first place?

For example, in my model, the interest rate in my model follows an AR(1) process:
r = c + phi*r(-1) + eta;
And I want the model to be solved with eta being a normal shock of some size:

var eta = sigma^2;

However, what if, once I have solved the model, I want to examine the IRF of the model to an interest rate that is constant (at a non-steady state level) for say 10 periods, and then switches to a different constant interest rate. I want such an interest rate process to be unanticipated, when in fact the anticipated interest rate process is just the one outlined above.

One option is to extract the policy function and do this manually. But with a 3rd or 2nd order approximation the explosiveness of the model means this isn’t handled well. In Dynare I get around this with pruning, but I’m not sure how I would replicate that manually.

What you are trying to do sounds like what conditional forecasting does: find a sequence of shocks that keeps a particular instrument constant. At first order that is straightforward. At higher order that is challenging. Because of nonlinearity, there will generally be several shocks combinations giving you the same path of endogenous variables. That is a conceptual challenge. Because of the non-existing one-to-one mapping between shocks and endogenous instruments, it seems also that there is no easy way to analytically compute one such shock sequence. You might have to write a solver that does that for you by looping over the simult_-command.

Thanks for responding. Luckily the interest rate process that I want to keep constant, other than being stochastic in the model, is otherwise exogenous and Markov. That is, the instrument that I want to keep constant, at time t, depends only on its value at time t-1 and a single time t shock. So, given an initial level of the instrument, it seems there should be a unique series of shocks that create the instrument path I would like?

Suppose I can determine the series of shocks that produces the interest rate - how do I tell Dynare to implement that shock sequence without actually solving for the 2nd/3rd order approximation on the basis of those shocks?

That is, in solving the model, I want:
var eta = sigma^2;

But then I have a different pre-specified path of eta that I would like to see the response to. Is there an easy way in Dynare to implement that?

First off, you need to be fully aware of what you are doing. At higher order, there is no certainty equivalence. For that reason, decision rules will depend on the stochastic properties of the exogenous processes. You can solve the model under

shocks; var eta = sigma^2; end;
and then use a different shock sequence that may be “inconsistent” with the stochastic process the decision rule was computed under. For example, you may specify a huge level shock that would almost never occur under specified sigma. If this is what you want, go for it.

Now to the implementation. What you need to do is use the simult_-function of Dynare to feed you computed shock sequence into the model. An example can be found at

Yes, I understand it’s an unusual request, but what you describe is indeed exactly what I need to go for for my work. Thank you very much for the advice.