[R] convergence=0 in optim and nlminb is real?

Adelchi Azzalini azzalini at stat.unipd.it
Tue Dec 17 17:32:06 CET 2013


On Tue, 17 Dec 2013 08:27:36 -0500, Prof J C Nash (U30A) wrote:

PJCN> If you run all methods in package optimx, you will see results
PJCN> all over the western hemisphere. I suspect a problem with some
PJCN> nasty computational issues. Possibly the replacement of the
PJCN> function with Inf when any eigenvalues < 0 or  nu < 0 is one
PJCN> source of this.

A value Inf is allowed, as indicated in this passage from the
documentation of optim:

  Function fn can return NA or Inf if the function cannot be evaluated
  at the supplied value, but the initial value must have a computable
  finite value of fn.

Incidentally, the documentation of optimx includes the same sentence. 

However, this aspect is not crucial anyway, since the point selected by
optim is within the feasible space (by a good margin), and evaluation of
the Hessian matrix occurs at this point.

PJCN> 
PJCN> Note that Hessian eigenvalues are not used to determine
PJCN> convergence in optimization methods. If they did, nobody would
PJCN> ever get promoted from junior lecturer who was under 100 if they
PJCN> needed to do this, because determining the Hessian from just the
PJCN> function requires two levels of approximate derivatives.

At the end of the optimization process, when a point is going to be
declared a minimum point, I expect that an optimizer  checks that it
really *is* a minimum. It may do this in other ways other than
computing the eigenvalues, but it must be done somehow. Actually, I
first realized the problem by attempting inversion (to get standard
errors) under the assumption of positive definiteness, and it failed.
For instance 

  mnormt:::pd.solve(opt$hessian)

says  "x appears to be not positive definite". This check does not
involve a further level of approximation.

PJCN> 
PJCN> If you want to get this problem reliably solved, I think you will
PJCN> need to
PJCN> 1) sort out a way to avoid the Inf values -- can you constrain
PJCN> the parameters away from such areas, or at least not use Inf.
PJCN> This messes up the gradient computation and hence the optimizers
PJCN> and also the final Hessian.
PJCN> 2) work out an analytic gradient function.
PJCN> 

In my ealier message, I have indicated that this is a semplified
version of the real thing, which is function mst.mle of pkg 'sn'.
What mst.mle does is exactly what you indicated, that is, it
re-parameterizes the problem so that we always stay within the
feasible region and works with analytic gradient function (of the
transformed parameters). The final outcome is the same: we land on
the same point.

However, once the (supposed) point of minimum has been found, the
Hessian matrix must be computed on the original parameterization,
to get standard errors.

Adelchi Azzalini

PJCN> 
PJCN> 
PJCN> > Date: Mon, 16 Dec 2013 16:09:46 +0100
PJCN> > From: Adelchi Azzalini <azzalini at stat.unipd.it>
PJCN> > To: r-help at r-project.org
PJCN> > Subject: [R] convergence=0 in optim and nlminb is real?
PJCN> > Message-ID:
PJCN> > <20131216160946.91858ff279db26bd65e187bc at stat.unipd.it>
PJCN> > Content-Type: text/plain; charset=US-ASCII
PJCN> >
PJCN> > It must be the case that this issue has already been rised
PJCN> > before, but I did not manage to find it in past posting.
PJCN> >
PJCN> > In some cases, optim() and nlminb() declare a successful
PJCN> > convergence, but the corresponding Hessian is not
PJCN> > positive-definite.  A simplified version of the original
PJCN> > problem is given in the code which for readability is placed
PJCN> > below this text.  The example is built making use of package
PJCN> > 'sn', but this is only required to set-up the example: the
PJCN> > question is about the outcome of the optimizers. At the end of
PJCN> > the run, a certain point is declared to correspont to a minimum
PJCN> > since 'convergence=0' is reported, but the eigenvalues of the
PJCN> > (numerically evaluated) Hessian matrix at that point are not
PJCN> > all positive.
PJCN> >
PJCN> > Any views on the cause of the problem? (i) the point does not
PJCN> > correspong to a real minimum, (ii) it does dive a minimum but
PJCN> > the Hessian matrix is wrong, (iii) the eigenvalues are not
PJCN> > right. ...and, in case, how to get the real solution.
PJCN> >
PJCN> >
PJCN> > Adelchi Azzalini
PJCN>



More information about the R-help mailing list