# Mode check plots look ok, but Hessian is still negative

**URL:** <https://forum.dynare.org/t/mode-check-plots-look-ok-but-hessian-is-still-negative/6347>\
**Category:** ML/Bayesian estimation\
**Created:** [11 July 2017 12:10 UTC](https://forum.dynare.org/t/mode-check-plots-look-ok-but-hessian-is-still-negative/6347 "2017-07-11T12:10:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert](https://forum.dynare.org/letter_avatar_proxy/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.dynare.org/u/Robert)\
**Post date:** [11 July 2017 12:10 UTC](https://forum.dynare.org/t/mode-check-plots-look-ok-but-hessian-is-still-negative/6347/1 "2017-07-11T12:10:07Z")

</div>

Dear all,

This question is kind of related to an earlier post by phuong.macro. I’m currently trying to find the mode(s) of my model and this has been achieved by running different optimizers. If you take look at the mode check plots, they seem to be alright, however I still get the warning:

[code]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.  
Warning: The results below are most likely wrong!

> In dynare\_estimation\_1 (line 316)  
> In dynare\_estimation (line 105)  
> In rob30 (line 1073)  
> In dynare (line 223)[/code]

What would be a good advice in this case? Most probably I am wrong with the interpretation of the graphs.

Best

Robert  
[mode\_check\_plots.zip](https://forum.dynare.org/uploads/default/original/2X/6/680243a25c00e8398df7781a45f4110355fa118f.zip) (41.7 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:** [12 July 2017 11:40 UTC](https://forum.dynare.org/t/mode-check-plots-look-ok-but-hessian-is-still-negative/6347/2 "2017-07-12T11:40:04Z")

</div>

Your mode\_check-plots indeed look good. What was the last optimizer you ran?

---

<div class="post-metadata">

**Author:** ![stepan-a](https://forum.dynare.org/user_avatar/forum.dynare.org/stepan-a/32/6652_2.png) [@stepan-a](https://forum.dynare.org/u/stepan-a)\
**Post date:** [12 July 2017 12:30 UTC](https://forum.dynare.org/t/mode-check-plots-look-ok-but-hessian-is-still-negative/6347/3 "2017-07-12T12:30:38Z")

</div>

Dear Robert,

It is important to understand that the **mode\_check** plots are only necessary (not sufficient) conditions. So these plots may look nice even if the hessian has the wrong sign. If you are convinced that you have the mode, you may try to play with the size of the perturbation used to compute the hessian matrix by finite difference. There is no interface for that, you have to manipulate options\_.gstep, a vector with two elements, before the **estimation** command. Look the top of the routine hessian.m to understand the respective roles of the elements of this vector.

Best,  
Stéphane.

---

<div class="post-metadata">

**Author:** ![Robert](https://forum.dynare.org/letter_avatar_proxy/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.dynare.org/u/Robert)\
**Post date:** [12 July 2017 14:07 UTC](https://forum.dynare.org/t/mode-check-plots-look-ok-but-hessian-is-still-negative/6347/4 "2017-07-12T14:07:21Z")

</div>

Dear Johannes,  
Dear Stephane,

Thanks for helping me with this. In order find the mode, I first use mode\_compute 6 and then the routine 7. Before I start playing around with options\_.gstep, would you recommend to maybe run a different solver (e.g. 8, 9 or 10) and load the old mode\_file of mode\_compute 7?

Thanks again for getting back to me!

Robert

---

<div class="post-metadata">

**Author:** ![stepan-a](https://forum.dynare.org/user_avatar/forum.dynare.org/stepan-a/32/6652_2.png) [@stepan-a](https://forum.dynare.org/u/stepan-a)\
**Post date:** [12 July 2017 14:19 UTC](https://forum.dynare.org/t/mode-check-plots-look-ok-but-hessian-is-still-negative/6347/5 "2017-07-12T14:19:20Z")

</div>

Dear Robert,

Unless you are specifically interested in the posterior mode, You can simply run the MCMC after the call to **mode\_compute=6**. It is not mandatory to use the posterior mode to define the initial conditions of the chains (we only want to start the chains from a point where the posterior density is not too small), and this optimization algorithm provides an estimate of the posterior covariance matrix needed for the jumping distribution.

Best,  
Stéphane.

---

<div class="post-metadata">

**Author:** ![Robert](https://forum.dynare.org/letter_avatar_proxy/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.dynare.org/u/Robert)\
**Post date:** [12 July 2017 15:22 UTC](https://forum.dynare.org/t/mode-check-plots-look-ok-but-hessian-is-still-negative/6347/6 "2017-07-12T15:22:04Z")

</div>

Dear Stephane,

Many thanks for your help and clearing that up. I always thought that under mode\_compute = 6, we are also have to find the “proper” mode before we can start the MCMC. Sorry, I should have read the dynare manual again. The approach of mode\_compute = 6 is different to the other optimisation routines. Thanks again Stephane!

Rob

---

<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:** [14 July 2017 18:24 UTC](https://forum.dynare.org/t/mode-check-plots-look-ok-but-hessian-is-still-negative/6347/7 "2017-07-14T18:24:09Z")

</div>

You would always like to start at the mode and typically with the inverse Hessian as this will often be the most efficient, i.e. you will need fewer draws than under any alternative. But sometimes this is not feasible. We know from theory (e.g. Chib/Greenberg (1995)) that the MCMC will explore the whole posterior parameter space starting from any point (not just the mode) with any positive definite proposal covariance matrix (not just the inverse Hessian). The issue is that this is an asymptotic result and you may not have enough time to wait for the MCMC to move to its ergodic distribution and sample from it. The autocorrelation of draws may be high so that many draws will be needed. Thus, if possible, try to work with other optimizers. But in difficult cases, mode\_compute=6 tends to be more forgiving than others, because of the way the covariance matrix for the proposal is constructed.

---

<div class="post-metadata">

**Author:** ![Robert](https://forum.dynare.org/letter_avatar_proxy/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.dynare.org/u/Robert)\
**Post date:** [18 July 2017 12:47 UTC](https://forum.dynare.org/t/mode-check-plots-look-ok-but-hessian-is-still-negative/6347/8 "2017-07-18T12:47:46Z")

</div>

Thanks Johannes, I will first try to find the mode with Newton type optimisers before I go back to mode\_compute = 6.

Best

Rob
