Third order perturbation

I have been trying to do a third order perturbation as you would see from the attached code. However, I do not understand how to create the impulse response functions under 3rd order. Can anyone help me with this? I have seen the posts under

but still not clear how to go about it.

Thanks.deficit_sticky.mod (4.7 KB)


The problem is with the size of your shocks, which are so large that all the simulations diverge. You should reduce the variance of your shocks and/or use the pruning option.


Thank you. Is the pruning option embedded in dynare. Also how to get the IRFs under third order. I am not sure if I am giving the right command to dynare. If you can provide a specimen file, it would be easy to see how it works.

I tried with this file deficit_sticky.mod (4.7 KB). I divided the size of the shocks by one hundred and added the pruning option. You may want to increase the number of simulations (controlled by the replic option, whose default value is 50). I also removed two shocks that do not appear in the model.


The pruning option is included in Dynare at orders 2 and 3. See the reference manual here.


         Can you please attach the revised file that you worked on?


I posted above a revised version of your mod file. I didn’t change the name.


Do I have to use simult_ here?

No. Unless you have to do fancy things… You just have to use stock_simul as shown in your revised file.

@steve_1983 Which type of IRF are you looking for? You can generate them at the ergodic mean (Andreasen et al. 2017, ReStud) or at the stochastic steady state/ergodic mean in the absence of shocks (Fernandez-Villaverde et al. 2011, AER, Born/Pfeifer 2014, JME, Basu/Bundick 2017, ECTA).

The Dynare default is GIRFs. As they are simulation-based, in contrast to the Andreasen et al. paper, you will need a lot of replications.

@jpfeifer As of now I was using the following code to generate IRFs

stoch_simul(order=3, nocorr, nomoments) - This did not generate any IRFs.

Stephane corrected me and asked me to reduce the size of the shocks and write the code as

stoch_simul(order=3, pruning, nocorr, nomoments) - I think this is what you are referring to as GIRFs if I correctly understand.

What code do I need to write to generate the IRFs at the ergodic mean/stochastic steady state?

Hello Stephane,

    As discussed, I used the command

(stoch_simul (order=3, pruning, replic=3000, nocorr, nomoments, irf=12); to get the IRFs. However, as you can see from the attached graphs, the IRFs are wiggly despite 3000 replications which took almost 30-40 minutes. Is there a better way to get smoother IRFs under order 3?


Hi Steve, I never played a lot with third order… I am not aware of another option for controlling this noise (the amplitude is much larger than what I would have expected). Maybe Johannes will have more ideas…


To get them less wiggly, you would need more replications (50000 or so), which is typically impractical.
There are essentially two ways to proceed:

  1. Use the Andreasen et al toolkit, which produces analytical GIRFs; it is not yet fully implemented into Dynare from our side, but we are working on it.
  2. Use IRFs around the stochastic steady state/EMAS. An example is at

Dear All,

Are there new features within Dynare 4.6.1 to generate higher order (generalzed) impulse responses within stoch_simul?

In case of pruning,
I usually compute GIRFs at the ergotic mean using the “simult_” Dynare utilty as shown in Prof. Pfeifer’s very useful websyte:

Mod-file showing how to compute state-dependent Generalized Impulse Responses (GIRFs) using simult_: RBC_state_dependent_GIRF.mod

Are there newer more automated ways to do this within the new Dynare version?

Many thanks again for the new amazing release!

No, not yet. This is still on our to-do-list