Welfare cost of business cycles

Dear Dynare users,

I would like to calculate the Welfare cost of business cycles associated to a particular monetary regime, as it is done in “Stabilization Policy and the costs of dollarization” by Schmitt-Grohé and Uribe (2000), section 6, pages 17-18.
How do I have to implement


in order to find \xi?
Suppose further that U(c,h)=\frac{c^{1-\sigma}}{1-\sigma}-\varphi\frac{n^{1+\nu}}{1+\nu}, I know that I have to take a second order approximation around the non-stochastic steady state. What I do not understand is how this can be implemented in Dynare. Where do I extract which information? Can this be done in an m. file outside of Dynare?

I’d appreciate a simple example code.



If you set order=2 and simulate a long enough time series, Dynare will provide you with E. Given that you know the functional form for utility as well as the steady state values for c and h, you can analytically solve
for \xi.

You might also be able to use theoretical moments, but there one would need to check whether second moments based on the first order approximation a la Kim/Kim/Schaumburg/Sims are sufficient.


Dear jpfeifer,
first of all thank you very much for your response.
I have a follow up question though: What do you mean by “simulate a long enough time series, Dynare will provide you with E”? What is “long enough” and where is “E” stored?
Do I have to specify in my model block something like U=\frac{c^{1-\sigma}}{1-\sigma}+\theta\frac{n^{1+\nu}}{1+\nu} and Welfare = U + \beta*Welfare(+1)? I have seen this approach in some blog entries but I do not see the intuition here.


I was referring to the fact that by the law of large numbers a long simulation will converge to the expected value. For this to work, you need to define U(c,h), but you have a formula for that. The expected value will be stored in oo_.mean after simulation (set periods=100000, that should suffice).

Welfare = U + \beta*Welfare(+1) is used when you want to compare welfare instead of just the period utility. The U in your example is the felicity function while Welfare is the lifetime utility computed as the infinite discounted sum of per period utilities. In order to enter the infinite sum into the computer, it is written recursively as
]Welfare = U + \beta*Welfare(+1)

Regarding the paper you cite, the way to implement your formula is given in equation (45). You know the parameters and Dynare will provide the variance of hat x_t.


Dear jpfeifer,
I understand now how to derive equation 45 in the paper and that I would measure welfare as the permanent relative change in consumption, \chi, that yields expected utility E. The first question here is then, where do I get the vector for the variance of hat x_t (which has the entries for variance of \hat c_t and variance of \hat n_t)?

Next, I must confess that there are several other things that confuse me:

  • What exactly is the difference of conditional and unconditional welfare? All my models have the same non-stochastic steady state, i.e. the steady state is independent of monetary policy regime.
  • Where is the difference in measuring welfare costs as


and measuring it as
V_t^A=\mathbb{E}_t\sum_{t=0}^{\infty}\beta^tU(c_t^A,n_t^A) //regime A
V_t^B=\mathbb{E}_t\sum_{t=0}^{\infty}\beta^tU(c_t^B,n_t^B) //regime B

where the welfare cost \chi is then

Following the approach where I have Welfare = U + \beta*Welfare(+1). How do I specify U when my model is in logs, would it then read exp(Welfare) = exp(U) + \beta*exp(Welfare(+1))? or Welfare = exp(U) + \beta*Welfare(+1)?

I hope to get some clarification here, as you see I am quite lost in the trees…

Best wishes,


The variances are saved in oo_.variance.

For the difference between conditional and unconditional welfare, see Section 3.3 “The Welfare Measure” in Schmitt-Grohe/Uribe (2004) “OPTIMAL SIMPLE AND IMPLEMENTABLE MONETARY AND FISCAL RULES”, NBER Working Paper 10253. It is important to look at this version of the paper and not later ones. In a nutshell, for one version you use the conditional expectations operator (given that you are in the determinstic steady state) and in the other one the unconditional one. This makes a difference because at higher order the system transitions from the deterministic steady state to the ergodic distribution. This transition is absent in the unconditional welfare measure as the expectation is taken over the ergodic distribution.

SGU (2001) “Stabilization Policy and the Costs of Dollarization” uses unconditional welfare.

For unconditional welfare, there is no difference between the two. The reason is linearity of the expectations operator. You want to compare unconditional lifetime utility in the steady state and under some policy. You have

\mathbb{E}\sum_{t=0}^{\infty}\beta^tU((1-\xi)\bar c,\bar n)=\mathbb{E}\sum_{t=0}^{\infty}\beta^tU(c_t,n_t)
This is
\sum_{t=0}^{\infty}\beta^t\mathbb{E}(U((1-\xi)\bar c,\bar n))=\sum_{t=0}^{\infty}\beta^t\mathbb{E}(U(c_t,n_t))
which is
1/(1-\beta)U((1-\xi)\bar c,\bar n)=1/(1-beta)\mathbb{E}(U(c_t,n_t))
and thus
U((1-\xi)\bar c,\bar n)=\mathbb{E}(U(c_t,n_t))

Hence, it is sufficient to compare the felicity functions because everything is stationary. The \xi you compute would be the same. Things are different if you use recursive utility or conditional welfare.

As you are not interested in a log approximation to Welfare itself, only in one for consumption and labor, you can use either representation. For extracting \xi, it does not matter whether your endogenous variable is log(Welfare) or Welfare itself (the same applies to U itself). But one warning: using a variable substitution with exp() implies that e.g. the argument of exp(U) is actually log(U) so that exp(log(U))=U. When doing this, you need to make sure that the original U which is now logged is not negative.

Dear jpfeifer,

thank you for your elaborate response which clarifies things a lot.
I understand now the difference in unconditional and conditional welfare and should be able to compute the measures.

I will be back with a code hopefully soon.

Best and thank you very much,


jpfeifer, just to make sure I understand the difference between conditional and unconditional welfare. Conditional welfare calculates the discounted future period utilities when the system starts from the deterministic steady state. On the other hand, unconditional welfare calculation starts from the stochastic steady state?

In dynare, I write welfare recursively as
Welf = Util + beta*Welf(+1);
where Util is the period utility.

Then I ask dynare to solve the the model to 2nd order. The theoretical mean of Welf corresponds to the conditional welfare, right? Then how do I compute unconditional welfare in this case?

brainking, there is another part of this forum where the question of unconditional vs. conditional welfare is adressed: Conditional welfare evaluation confusion From Michel’s post there, I understand that the welfare you calculate with your approach (theoretical mean of welfare) is unconditional welfare. Conditional welfare you can obtain from running simulations.

1 Like

The difference between conditional and unconditional welfare is not about the mean, it is about the conditioning set for the expectations operator. The mean aims at computing an expected value. That expected value can either be the unconditional expected value

or a conditional expected value, i.e. conditional on the information at time t.

The unconditional mean (as e.g. saved in oo_.mean) can be interpreted as integrating out initial conditions and future shocks. In contrast, the conditional mean will take the starting point in the state space at time t into account and only integrate over future shocks.
For that reason, the conditional welfare takes into account e.g. the amount of capital you have at time t when you want to compute conditional welfare. Taking the steady state as the conditioning set is a common choice, but only one of infinitely many potential choices at which to evaluate conditional welfare.


Dear Professor Pfeifer,
I read this post and other discussions on this topic but still there is something that is not clear to me. I would like to do a very simple exercise, that is to find the parameter of a policy rule that maximizes conditional expected welfare, defined as Welfare = U + \beta*Welfare(+1) where the condition is being in the deterministic steady state in the first period. Moreover, the parameter has no impact on the deterministic steady-state. I am using a 2nd order approximation and I am wondering how to find in Dynare the welfare that I have to maximize.

Maximizing the welfare ergodic mean (oo_.mean) is not correct because, as you say, this gives me the unconditional expected welfare. I think the right approach is to maximize the stochastic steady-state of welfare, where the stochastic steady state is defined as the point where the agents decide to stay in the absence of shocks, but taking into account the likelihood of future shocks: is this the method used in Schmitt-Grohe and Uribe (2004) “Optimal simple and implementable monetary and fiscal rules” and in many other papers?
If yes, is it correct to compute the stochastic steady state by i) using simult_ with a vector of zeros as the shock input starting from the deterministic steady state and ii) taking the last value of the output of simul_t ?

stoch_ss =convergence_stoch_ss(:,T);

Thank you very much, best wishes,

1 Like

Dear Valerio, that would not be correct. Because when you simulate without shocks, you end up at the stochastic steady state, which is different from the deterministic one where you want to evaluate welfare (except for first order). At second order, the policy function for welfare (defined in the model recursively as W_t=U+beta*W(+1) or something similar) will have the form

y_t=y_bar + 0.25 g_sssigma^2 + terms that depend on shocks and deviations from steady state (see section 4.13.4 of the manual)

In the deterministic steady state, these last terms are 0 because shocks are 0 and deviations from steady state are 0. What you are therefore left with is

y_t=y_bar + 0.25 g_sssigma^2

which is related to, but not equal to the stochastic steady state. Thus, what you need to look at in this case is the steady state plus the uncertainty correction. Denoting Welfare with


you need to look at


which is the Constant
in the display of


Thank you very much, now I got the point.

Anyway, I think it should be

if W_pos is the position in the declaration order.

Best wishes,


Yes, my mistake. I fixed it above in my post as well.

one follow up question on this: if I’m interested in the the welfare gain measured in consumption equivalents (xi) it does not matter whether the original U (utility) is negative or positive, correct?
Thanks, Johanna

Correct. The problem only appears if you want to take the log of a negative number.


I have to get back to one of the earlier problems by Philipp, which is the following

Now, to find \chi, I did a second-order approximation of the right hand side of the last equation by hand and collected all the components which I need from the output of Dynare (steady state values of L and C, stochastic steady states of L and C and variances of L and C around the stochastic steady state). To check whether I did everything right, I calculated the right hand side also for regime B (in this case \chi is obviously 0) and compared the left hand side (which one can directly take from Dynare) to the right hand side. They should be the same, but they are not! Now, I don’t understand where the mistake is. Did I misunderstand the whole matter or did I for example make a mistake in getting the variances from Dynare (I tried two different versions). I checked my SO approx. various times, so I think it is correct.

I included my matlab file with which I did the comparison. It is based on the FA.mod file which can be found on Peter Karadi’s homepage.

Thanks a lot for your help!

FA_check.mod (7.9 KB)
welfarecheck.m (1.7 KB)

I think, I found the mistake myself: when doing the 2nd-order approx. of welfare by hand, I pulled the expectations operator into the functions, e.g. E_0\ln C_t = \ln E_0 C_t, which, I think is accurate only up to first-order. That’s mayby also a reason why SGU use this multiplicative utility function, this way, they can calculate \lambda^c (or \chi in the above equations) directly from V^a_t and V^b_t.

Did anyone find a way to calculate \lambda^c with a separable utility function?

Yes, you seem to have ignored Jensen’s Inequality. What are you trying to compute? A fraction of steady state consumption? Or a fraction of dynamic regime A consumption? Regardless, for a separable utility function, you can typically factor out the consumption fraction as labor is kept the at the respective regime value.

As in SGU (2004) I was trying to compute "\lambda as the fraction of regime r’s consumption process that a household would be willing to give up to be as well off under regime a as under regime r". And I am pretty sure that with a separable utility function you cannot do the transformation which is done at the bottom of p.18 in the 2004 NBER WP. There would be an endless sum of labor on the RHS of the equation. I don’t understand what you mean by “labor is kept at the respective regime value”? Are you suggesting that h^r_t=h^a_t for all t?