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 on April 23, and its replacement, 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   "Prieger, James" <>
To   <>
Subject   RE: st: mata moptimize with Nelder-Mead option: why does it care about Hessian?
Date   Mon, 5 Jul 2010 14:16:52 -0700

Thanks, Jeff.  I have since fixed the missing values problem (as well as some of the other issues you noted) and got it to work.  
If I can put in a humble request while on the topic of "nm": I would have benifitted from more documentation on this option in the manual. The usually chatty manuals have little to say about nm or how it is implemented in Stata.  (Perhaps that befits its status as a little-used option.)
James Prieger
Associate Professor
Pepperdine University


From: on behalf of Jeff Pitblado, StataCorp LP
Sent: Wed 6/30/2010 9:42 AM
Subject: Re: st: mata moptimize with Nelder-Mead option: why does it care about Hessian?

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–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index