# How to analyze welfare loss function

**URL:** <https://forum.dynare.org/t/how-to-analyze-welfare-loss-function/12615>\
**Category:** Optimal Policy\
**Created:** [17 October 2018 12:33 UTC](https://forum.dynare.org/t/how-to-analyze-welfare-loss-function/12615 "2018-10-17T12:33:25Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![aibenaimer1](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/c89c15/32.png) [@aibenaimer1](https://forum.dynare.org/u/aibenaimer1)\
**Post date:** [17 October 2018 12:33 UTC](https://forum.dynare.org/t/how-to-analyze-welfare-loss-function/12615/1 "2018-10-17T12:33:25Z")

</div>

Dear all，  
I established a logarithmic linearization model. I want to analyze the welfare loss function，like  
lambda\_x \*var(y\_hat)+var(pi\_hat). Can someone tell me how to do it? If there is an example, it is best.

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [18 October 2018 09:38 UTC](https://forum.dynare.org/t/how-to-analyze-welfare-loss-function/12615/2 "2018-10-18T09:38:50Z")

</div>

What exactly do you want? If you already derived your linear-quadratic model, then you can simply plug in the numbers. See for example

> <https://github.com/JohannesPfeifer/DSGE_mod/blob/master/Gali_2015/Gali_2015_chapter_4.mod>

---

<div class="post-metadata">

**Author:** ![Barrie](https://forum.dynare.org/letter_avatar_proxy/v4/letter/b/838e76/32.png) [@Barrie](https://forum.dynare.org/u/Barrie)\
**Post date:** [20 April 2019 08:49 UTC](https://forum.dynare.org/t/how-to-analyze-welfare-loss-function/12615/3 "2019-04-20T08:49:57Z")

</div>

excuse me, professor, I want to know why the wealfare loss function (like line 316 in your code) shall be divided by 100? Thank you!

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [22 April 2019 16:36 UTC](https://forum.dynare.org/t/how-to-analyze-welfare-loss-function/12615/4 "2019-04-22T16:36:46Z")

</div>

Because it is expressed in percent so that 0.01 is one percent. The reason is that we are dealing with a linear model where a standard deviation of 1 for the shocks has been used to mean 1 percent. One needs to undo this to match the numbers in the book. A more thorough way would be to use 0.01 as the shock standard deviation and not divide welfare by 100.

---

<div class="post-metadata">

**Author:** ![Tavinho](https://forum.dynare.org/user_avatar/forum.dynare.org/tavinho/32/8339_2.png) [@Tavinho](https://forum.dynare.org/u/Tavinho)\
**Post date:** [4 September 2019 04:48 UTC](https://forum.dynare.org/t/how-to-analyze-welfare-loss-function/12615/5 "2019-09-04T04:48:39Z")

</div>

Dear Professor. I have a follow up question on this topic.  
How can I use this example to do welfare analysis using a **nonlinear model** (such as **Gali\_2015\_chapter\_3\_nonlinear.mod** )? Can use the same definition of natural output and interest rate and add them to the model block? Do I need to change anything in the Loss Function?

Thank you very much for your patience. I really appreciate it.

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [4 September 2019 08:10 UTC](https://forum.dynare.org/t/how-to-analyze-welfare-loss-function/12615/6 "2019-09-04T08:10:52Z")

</div>

Please see [https://github.com/JohannesPfeifer/DSGE\_mod/blob/master/Born\_Pfeifer\_2018/Welfare/Born\_Pfeifer\_2018\_welfare.mod](https://github.com/JohannesPfeifer/DSGE_mod/blob/master/Born_Pfeifer_2018/Welfare/Born_Pfeifer_2018_welfare.mod)

---

<div class="post-metadata">

**Author:** ![alisa](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@alisa](https://forum.dynare.org/u/alisa)\
**Post date:** [22 May 2020 09:00 UTC](https://forum.dynare.org/t/how-to-analyze-welfare-loss-function/12615/7 "2020-05-22T09:00:20Z")

</div>

Dear professor,  
I need to compute the welfare: W=U+BETA\*W(+1), but I am using a linear model. Do you know how can I do it?  
I computed already the central bank loss function. I attach my code,  
Many, many thanks in advance!

[linear quadratic welfare.mod.txt|attachment][simple welfare analysis.mod.txt](https://forum.dynare.org/uploads/short-url/iWqW6UtMpUVfLXN42RiioH0PwqA.txt) (7.4 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [22 May 2020 13:48 UTC](https://forum.dynare.org/t/how-to-analyze-welfare-loss-function/12615/8 "2020-05-22T13:48:55Z")

</div>

That is not easily possible. A linear model will not contain the required information like the constants for a full welfare analysis. But of course you can do a quadratic approximation to utility.

---

<div class="post-metadata">

**Author:** ![alisa](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@alisa](https://forum.dynare.org/u/alisa)\
**Post date:** [22 May 2020 14:32 UTC](https://forum.dynare.org/t/how-to-analyze-welfare-loss-function/12615/9 "2020-05-22T14:32:50Z")

</div>

Thanks a lot for your reply professor, you mean a kind of a central bank loss function in terms of output gap and inflation?

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [22 May 2020 15:04 UTC](https://forum.dynare.org/t/how-to-analyze-welfare-loss-function/12615/10 "2020-05-22T15:04:42Z")

</div>

No, not necessarily. You could approximate utility in its arguments.

---

<div class="post-metadata">

**Author:** ![alisa](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@alisa](https://forum.dynare.org/u/alisa)\
**Post date:** [22 May 2020 17:55 UTC](https://forum.dynare.org/t/how-to-analyze-welfare-loss-function/12615/12 "2020-05-22T17:55:33Z")

</div>

Thanks a lot professor, in the end I get a linear quadratic approximation that includes terms at the steady state in terms of consumption and labor, how should I implement these steady state terms (as part of the function) in dynare?  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [24 May 2020 12:04 UTC](https://forum.dynare.org/t/how-to-analyze-welfare-loss-function/12615/13 "2020-05-24T12:04:13Z")

</div>

There are two ways:

1. You can drop the steady state as it should be the same for all parameter values.
2. You need to specify the steady state of the nonlinear model as parameters of your linearized model. Of course, then you have to compute them.

---

<div class="post-metadata">

**Author:** ![izacgross](https://forum.dynare.org/letter_avatar_proxy/v4/letter/i/8edcca/32.png) [@izacgross](https://forum.dynare.org/u/izacgross)\
**Post date:** [24 May 2020 15:06 UTC](https://forum.dynare.org/t/how-to-analyze-welfare-loss-function/12615/14 "2020-05-24T15:06:29Z")

</div>

Hi, I had a question regarding the calculation of the conditional welfare function eg (W=U+BETA\*W(+1)).

If you have a loss function (U) with 3rd order terms, would it be possible to solve the model to a third order and the zero out all rows in oo\_.dr.g\_3 that relate to all other variables to solve the rest of the model to the second (or first) order?

Thus the core of the model is solved to a 1 or 2 order approximation, while we track the loss function to the third order?

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [25 May 2020 08:32 UTC](https://forum.dynare.org/t/how-to-analyze-welfare-loss-function/12615/15 "2020-05-25T08:32:29Z")

</div>

I cannot answer that question in general. We know that linear-quadratic approaches are only valid under particular conditions. The same should apply here if you move everything up by one order.

---

<div class="post-metadata">

**Author:** ![alisa](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@alisa](https://forum.dynare.org/u/alisa)\
**Post date:** [25 May 2020 14:07 UTC](https://forum.dynare.org/t/how-to-analyze-welfare-loss-function/12615/16 "2020-05-25T14:07:59Z")

</div>

Dear professor,  
Thanks for your reply, what do you mean by “drop the steady state”? My model is linear, and at the end I get the term u\_nN/U\_c C, as in the figure below, should I just cancel it out?

 ![image](https://forum.dynare.org/uploads/default/original/2X/4/49d744d910413fd6ee64b1defc97c5947524e369.png)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [26 May 2020 09:07 UTC](https://forum.dynare.org/t/how-to-analyze-welfare-loss-function/12615/17 "2020-05-26T09:07:48Z")

</div>

I see. You need the steady state for the deviation part. Then you cannot drop it. You need to compute it.
