Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[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   jpitblado@stata.com (Jeff Pitblado, StataCorp LP)
To   statalist@hsphsun2.harvard.edu
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 <James.Prieger@pepperdine.edu> 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.

--Jeff
jpitblado@stata.com
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index