Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: mata moptimize with Nelder-Mead option: why does it care about Hessian?

From (Jeff Pitblado, StataCorp LP)
Subject   Re: st: mata moptimize with Nelder-Mead option: why does it care about Hessian?
Date   Wed, 30 Jun 2010 11:42:58 -0500

James Prieger <> is getting an unhelpful error
message from -moptimize()- while using the Nelder-Mead technique:

> Does anyone have experience using moptimize in Mata with technique "nm"
> (Nelder-Mead)?  I am trying to use it, but upon execution get the error
> message
> "Hessian is not negative semidefinite"
> Why would moptimize care about the Hessian if I'm using Nelder-Mead?  I
> thought the point of the simplex method was for it to work when the
> likelihood function isn't continuous or differentiable.  Does
> evaluatortype d0 still try to find first and second derivatives anyway?
> Code excerpt:
> mata:
> M = moptimize_init()
> moptimize_init_evaluator(M, &LLiklRenApp())
> moptimize_init_evaluatortype(M, "d0")
> moptimize_init_depvar(M, 1, "y c0 c1 c2 c3 z0 z1 z2 z3 a g tau d") //
> yes, this is a messy problem!
> moptimize_init_depvar(M, 2, "")
> moptimize_init_eq_indepvars(M, 1, "x")
> moptimize_init_eq_indepvars(M, 2, "")
> moptimize_init_eq_indepvars(M, 3, "")
> moptimize_init_technique(M, "nm")
> delta = J(1,4,.1)
> moptimize_init_nmsimplexdeltas(M, delta)
> moptimize(M)
> end

The "nm" technique reported this error message because the likelihood
evaluator returned a missing value while -moptimize()- took the initial step
within an iteration.  It should have returned the message

	"missing values returned by evaluator"

We will fix this in a future ado-file update to Stata.

In looking at James' code, I noticed the following things:

1. The first call to -moptimize_init_depvar()- provides a varlist, which is
   allowed, but the second call provides an empty string.  Although it is
   tolerated, the second call is redundant and unnecessary.

2. There appear to be 3 equations, based on the calls to
   -moptimize_init_eq_indepvars()-.  However James provides a vector of 4
   values to -moptimize_init_nmsimplexdeltas()-.  This should have caused the
   following error message:

	"simplex delta not conformable with parameter vector"

If James provides us with data and the code for his likelihood evaluator, we
might have more to comment on.

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index