Numerical unconditional welfare cost Versus Analytical one

Dear all,

I have an issue on which I need your help, please.

I am using Johannes Pfeifer’s program for computing the welfare cost in terms of equivalent consumption.

My problem is that, when I use this code for computing the unconditional welfare cost, I get a welfare cost value different from that I obtain by doing analytically (as the unconditional welfare can be solved by hand).

What would be the matter? Do anyone has an idea?

Here, I am attaching the code.

Thank you in davance for your (219.8 KB)

What are you doing here? Your code does have no resemblance at all to my codes at

Dear Johannes,

Yes, there are differences as I adapted your code to my model. What I ma doing is that:

  • I derived by hand the unconditionnal welfare cost in terms of steady state consumption (say xi) as mean of welfare is knew and ss values of variables entering in felicity as well. E[U(c,h)] =(1/(1-BETA))*\frac{((1-\xi)*c_ss)^{1-\sigma}}{1-\sigma}-\varphi\frac{n_ss^{1+\nu}}{1+\nu}
  • I compare this welfare cost with the one the solver ‘Csolve’ provides. To use the solver, I wrote the equation in which I have the the difference between the welfare mean (the left hand side ) and the SS expression of welfare including (the right hand side). The solver then provide xi;

The problem is that I do not find the same value of xi in the two cases.
Please can you help me? Thank you.


I see. But this has nothing to do with the code I use. If the two are different, you need to check why. What happens if you plug in your analytical result into the formula you are solving with fsolve? If it does not return 0, there must be a mistake in one of the two equations.