# Problem with 'POSTERIOR KERNEL OPTIMIZATION PROBLEM!'

**URL:** <https://forum.dynare.org/t/problem-with-posterior-kernel-optimization-problem/19936>\
**Category:** ML/Bayesian estimation\
**Created:** [9 March 2022 04:53 UTC](https://forum.dynare.org/t/problem-with-posterior-kernel-optimization-problem/19936 "2022-03-09T04:53:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hua](https://forum.dynare.org/letter_avatar_proxy/v4/letter/h/cdc98d/32.png) [@Hua](https://forum.dynare.org/u/Hua)\
**Post date:** [9 March 2022 04:53 UTC](https://forum.dynare.org/t/problem-with-posterior-kernel-optimization-problem/19936/1 "2022-03-09T04:53:25Z")

</div>

Dear all:  
I’m doing Bayesian estimation, having  
[estimate\_newway.mod](https://forum.dynare.org/uploads/short-url/vZpolkiKDxG8YkV3EZVKa8lpFRE.mod) (7.6 KB)  
[data2.xlsx](https://forum.dynare.org/uploads/short-url/4pHDn8mK1pYb1Gi8VaJiGLubaW0.xlsx) (16.7 KB)  
some problems  
After I run the mod file, the likelihood turns out to be -18939095987714.35, it’s a weird result  
And there is a warning:  
POSTERIOR KERNEL OPTIMIZATION PROBLEM!  
(minus) the hessian matrix at the “mode” is not positive definite!  
=\> posterior variance of the estimated parameters are not positive.  
You should try to change the initial values of the parameters using  
the estimated\_params\_init block, or use another optimization routine.  
警告: The results below are most likely wrong!

> 位置：dynare\_estimation\_1 (第 315 行)  
> 位置: dynare\_estimation (第 105 行)  
> 位置: estimate\_newway.driver (第 620 行)  
> 位置: dynare (第 293 行)

Finally I don’t get the parameters’ posterior distributions.  
Can someone help me with it? Thanks a lot!

---

<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:** [9 March 2022 13:12 UTC](https://forum.dynare.org/t/problem-with-posterior-kernel-optimization-problem/19936/2 "2022-03-09T13:12:17Z")

</div>

See [Bayesian estimation has a problem - #7 by jpfeifer](https://forum.dynare.org/t/bayesian-estimation-has-a-problem/15008/7)

---

<div class="post-metadata">

**Author:** ![Hua](https://forum.dynare.org/letter_avatar_proxy/v4/letter/h/cdc98d/32.png) [@Hua](https://forum.dynare.org/u/Hua)\
**Post date:** [10 March 2022 07:42 UTC](https://forum.dynare.org/t/problem-with-posterior-kernel-optimization-problem/19936/3 "2022-03-10T07:42:51Z")

</div>

Thanks for your reply, professor!

I redisposed the data according to your guide ‘A Guide to Specifying Observation Equations for the Estimation of DSGE Models’. I take the data in the logarithm form and detrend it by hp filter.

Then the mod file seems to run more fluently, but still gets some errors in the 14th iteration. The warning showed on the screen is the same as before. Could you help me find where the problem is, please?  
[estimate\_newway.mod](https://forum.dynare.org/uploads/short-url/wnSyIT9YU6IMxa19HkEBBK01XUw.mod) (7.6 KB)  
[data4.xlsx](https://forum.dynare.org/uploads/short-url/dib9Z5jlcZlzUNi148nsX6Ft24i.xlsx) (17.8 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:** [10 March 2022 09:44 UTC](https://forum.dynare.org/t/problem-with-posterior-kernel-optimization-problem/19936/4 "2022-03-10T09:44:39Z")

</div>

Try providing an analytical steady state. For many parameter values the steady state cannot be found.

---

<div class="post-metadata">

**Author:** ![Hua](https://forum.dynare.org/letter_avatar_proxy/v4/letter/h/cdc98d/32.png) [@Hua](https://forum.dynare.org/u/Hua)\
**Post date:** [11 March 2022 06:58 UTC](https://forum.dynare.org/t/problem-with-posterior-kernel-optimization-problem/19936/5 "2022-03-11T06:58:41Z")

</div>

Your advice is very useful!  
Thanks a lot for your help!
