Welfare and Pruning


I am working with a medium-scale two-agent New Keynesian model with government spending and want to analyse the welfare effects of a 1% increase in fiscal spending using the methodology set out in Schmitt-Grohe and Uribe (2004). The approach I’m using is summarised below and the associated Dynare code is as follows:


I then simulate the model at second order; to avoid explosive simulations, I turn on the pruning option.

I have two questions arising from this exercise

  1. 2nd order + pruning leads to sizeable differences in the simulated IRFs, including a sign change for one of the variables. In addition, while G (normalised by steady state) is 1 at t=0 for order=1, I instead get g>1 for order=2. Is there a way of avoiding this result (without resorting to the simulation of very small shocks)?
  2. I am not entirely sure whether my code properly implements the use of a conditional welfare metric correctly – any feedback would be very valuable.

I’d greatly appreciate any help with this!

Best wishes,

Hi Lukas,

did you see this discussion: Welfare cost of business cycles
It might help to answer parts of your questions.

I don’t use pruning when I run the second-order approx. for the calculation of welfare, instead, I just set irf=0. If I don’t set irf=0, I get the message:
stoch_simul:: The simulations conducted for generating IRFs to eps_A1 were explosive.
stoch_simul:: No IRFs will be displayed. Either reduce the shock size,
stoch_simul:: use pruning, or set the approximation order to 1.

To be honest, I don’t know why exactly it works this way and whether setting irf=0 does the job in general or just in my model. And I’m also a bit confused regarding the phrase “The simulations conducted…” given that in the FAQ section of Dynare it is written that “Solutions are technically not simulations (although the literature commonly refers to impulse response functions as being “simulated”). They are instead straightforwardly “solutions” to a constrained maximization problem (initiating a system of difference equations).”

Maybe someone could help to clarify this issue as well?


I agree that the FAQ is not very clear (at best)… Actually this is very old material, I do not remember who wrote this section, and would not rely on this (maybe we should remove this FAQ from the website, since we do not have time to maintain it). If I understand the quote correctly I am forced to disagree. In a rational expectation context, IRFs are simulations. The solution of a rational expectation model is a reduced form model, which in turn is used to simulate the model (stochastic simulations or IRFs) or compute theoretical moments. My understanding is that there is here a confusion with the perfect foresight context (where the generated paths for the endogenous variables are solution of large system of non linear equations).

When you put irf=0, since periods is equal to zero by default, you instruct Dynare not to perform any simulations with the computed reduced form. That’s why it works. The pruning is only used to prevent explosive paths for the simulations, which are not required to compute the welfare cost of fluctuations.


You can evaluate conditional and unconditional welfare without simulations. I will try to upload an example in the next couple of days.

Fantastic, thank you very much indeed!

Thank you for the clarification!

The files are now available at

Thank you for uploading the files. Does it have a particular reason why you calculate conditional welfare based on a simulation instead of calculating the steady state plus the uncertainty correction as described in https://forum.dynare.org/t/welfare-cost-of-business-cycles/3802/12? Is it because you are not actually extracting welfare from the Dynare output, but already the welfare gain/loss in consumption equivalents?

It is not really a simulation. The function generally does simulations, but the way I use it is to just compute the left-hand-side of the policy function given the provided values for states and shocks on the right-hand-side. That way, you can evaluate conditional welfare at any given point. The linked post is only concerned with the steady state and is quite error prone if you do it manually.

Fantastic! Thank you, Professor Pfeifer.