Any way of implementing conditional IRFs?

I am extending the FV baseline model to account for energy. I want to study to effect of energy uncertainty shock on the economy.

Problem: There is a taylor type monetary policy. CB increases interest rate in response to rising inflation thus causing economic contraction.

Question: I want to isolate the effect of uncertainty shock from the effect of monetary policy. Is there any way i could generate IRFs to uncertainty shock conditional on that the CB does not react?

Manually setting interest rate to steady state interest rate does not work. I get the following error;

Blanchard Kahn conditions are not satisfied:

This makes sense since the system explodes if nominal interest rate does not increase more than one-to-one in response to inflation.

What you have in mind is a partial equilibrium example so you should try to study it in this type of environment (other people also call it a small open economy). Alternatively, you need to feed in a series of monetary policy shocks to keep the interest rate constant.

P.S.: See Cochrane (2011): Cochrane 2011 - Determinacy and Identification with Taylor Rules on the correct interpretation of the Taylor principle. It is NOT


Is there a way of implementing the ‘feed in a series of MP shocks’ in dynare? It sounds similar to the conditional forecasting exercise which dynare allows for. From what i understand about conditional forecast, dynare works out the desired value of the corresponding shock to ensure that the variable has the specified value over the forecast period.

The standard way to do this is to use the simult_ function to simulate the model with any desired shock sequence. An example is at
You can also try the conditional_forecast command to let Dynare compute the required shocks, although this won’t be as flexible.

Thanks a lot. simul_ is very helpful.

Here is what I do:

[code]dynare NK_baseline_OC %run at order=1

%initialize IRF generation
initial_condition_states = repmat(oo_.dr.ys,1,M_.maximum_lag);
shock_mat = zeros(options_.irf,M_.exo_nbr); %create shock matrix with number of time periods in colums
%set shocks for pure news
shock_mat(1,strmatch(‘eaf’,M_.exo_names,‘exact’)) = 1; %set news shock to 1 (use any shock size you want)
out_withshock = simult_(initial_condition_states,oo_.dr,shock_mat,options_.order);
IRFS_euaf = out_withshock(:,M_.maximum_lag+1:end)-repmat(oo_.dr.ys,1,options_.irf); %deviation from steady state

my model is written in levels. I add the following transformation for the variables I am interested in such that:

ytil = log(y);

I then plot the IRFs from IRFS_euaf for the variables which I have transformed so the IRFs represent %age deviation from the s.s. (i hope this is correct?)

Firstly, the IRFs generated are very similar to those generated by Dynare. Except that the magnitude of response is larger compared to Dynare IRFs. Why is this?

Secondly, the IRFs generated become very different than the Dynare GIRFs when I run the model at order=3 with pruning. This is probably because of pruning? How do I deal with pruning using the simul_ code? Since I am originally interested in the volatility shocks, I need to make it work for order=3. Also I want to stick with GIRFs and not switch to IRFs from ergodic mean.

Once I have it working, I can do what you suggested: feed in the monetary policy shocks to make sure nominal interest rate do not change in response to the shock I am interested in.


  1. You currently do a 1 unit shock with simult_. Dynare does a one-standard deviation shock. Unless the standard deviation is 1, the size will be different.
  2. At higher order, the different shock size matters due to non-linearities. The simult_ function inherits the pruning option set in the global options_.structure. For that reason, if you want to enable pruning, just set

before calling simult_.
3. What you currently do are not GIRFS. For these, see

  1. Got it. When I set …

… I get the same responses as those produced by Dynare at order=1.

  1. Got it. When I code as you have coded in the mod file, I get the same responses as those produced by Dynare under …

Indeed I have adjusted the parameters in the mod file according to the specification in the stoch_simul command above.

  1. I do not understand this part. Do I specify it like …

options_.pruning=1 out_withshock = simult_(initial_condition_states,oo_.dr,shock_mat,options_.order);
? What does it achieve?

I think you have already answered all my questions.

I have one last question. My model is in levels and quarterly. Steady state interest rate and inflation are in 1+x (eg. 1.01) format. Since I want to plot my IRFs as %age deviation from the steady state, do I need to log-transform these variables as well just like output, consumption etc [eg. ytil=log(y)]? I have read different threads and the Guide book for observation equations but for some reason I cannot understand this fully.

Thanks a lot. I have corrected all the errors I was making. Your help has been amazing. Grateful!

Regarding 2.:

turns on pruning by setting the respective option in the global options_ structure, which is then accessed by simult_

To your last question: if you want to have percentage deviations, you generally have to use logs. However, log(1+x) is approximately x for small x, so there will not be much difference.

Thank you very much. I have everything working now.