# Calculated the optimal coefficients

**URL:** <https://forum.dynare.org/t/calculated-the-optimal-coefficients/13092>\
**Category:** Optimal Policy\
**Created:** [14 January 2019 12:32 UTC](https://forum.dynare.org/t/calculated-the-optimal-coefficients/13092 "2019-01-14T12:32:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiang](https://forum.dynare.org/letter_avatar_proxy/v4/letter/j/3e96dc/32.png) [@jiang](https://forum.dynare.org/u/jiang)\
**Post date:** [14 January 2019 12:32 UTC](https://forum.dynare.org/t/calculated-the-optimal-coefficients/13092/1 "2019-01-14T12:32:54Z")

</div>

Dear dynare team, here I want to ask a question, I saw many people use Schmitt-Grohe and Uribe (2004,2007) to calculate the optimal policy coefficients based on welfare-maximizing rules. In the forum and dynare example reference I saw some use dynare osr or more complex approach, i.e., useing some optimizer fmincon, csminwel, cmaes for external function file to solve policy function coefficient. I use the dynare approach but my results are not same with the paper which use SGU’s approach. Thanks a lot.

My best,  
ZL

---

<div class="post-metadata">

**Author:** ![jiang](https://forum.dynare.org/letter_avatar_proxy/v4/letter/j/3e96dc/32.png) [@jiang](https://forum.dynare.org/u/jiang)\
**Post date:** [14 January 2019 12:37 UTC](https://forum.dynare.org/t/calculated-the-optimal-coefficients/13092/2 "2019-01-14T12:37:40Z")

</div>

And paper numerically compute welfare at the non-stochastic steady state using a second-order approximation of the utility functions of the households in the economy. I use the dynare command , but the results are differ. Why?

---

<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 January 2019 05:37 UTC](https://forum.dynare.org/t/calculated-the-optimal-coefficients/13092/3 "2019-01-18T05:37:10Z")

</div>

I am not sure I understand the question. What exactly are you doing and where do the results differ? For distorted steady states the OSR-command of Matlab is not suitable. You would need to proceed with a nonlinear model and the maximize the objective. See for example the post

> [@Loop over parameters to find maximized welfare](https://forum.dynare.org/t/loop-over-parameters-to-find-maximized-welfare/12358/2):
>
> In your case, you only need to read out the welfare. As you are not computing a consumption-equivalent, you do not need the function I write. Welfare is a stochastic property of the model, but you are reading out the steady state instead of the unconditional mean. The steady state will always be the same. You need to read out the respective element of oo\_.mean and for that cannot use nomoments. Also, you need to add welfare to the variables after stoch\_simul to get its moments. Are you sure you…
