Re: [R] optim error

From: Rich Townsend <>
Date: Sat 12 Aug 2006 - 02:05:58 EST

If you have an idea of the ranges of your parameters, I've found that the DEoptim package has been excellent for finding good starting values for very large likelihood equations, then finishing it up with the optim() to get the final estimates.


School of Aquatic & Fishery Sciences
University of Washington

> -----Original Message-----
> From: Vaidotas Zemlys []
> Sent: Thursday, August 10, 2006 7:07 AM
> To: Frank Black
> Cc:
> Subject: Re: [R] optim error
> Hi,
> On 8/9/06, Frank Black <> wrote:
> > Dear all,
> >
> > There have been one or two questions posted to the list
> regarding the
> > optim error "non-finite finite-difference value [4]." The error
> > apparently means that the 4th element of the gradient is
> non-finite.
> > My question is what
> > part(s) of my program should I fiddle with in an attempt to fix it?
> > Starting values? Something in the log-likelihood itself?
> Perhaps the data
> > (which is generated)? Any thoughts would be greatly appreciated.
> >
> Use Nelder-Mead algorithm for finding apropriate starting
> values. This algorithm does not use gradients, so you will
> not aforementioned error. After Nelder-Mead you can try again
> with gradient methods, like BFGS. If that does not help, try
> scaling your data. Optim behaves better (IMHO) when all
> parameters are of the same order. If you do not need hessian,
> and BFGS fails, use only Nelder-Mead, it will at least give
> you something.
> Vaidotas Zemlys
> --
> Doctorate student, Vilnius University
> mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Sat Aug 12 02:11:52 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 12 Aug 2006 - 04:20:25 EST.

Mailing list information is available at Please read the posting guide before posting to the list.