[R] optim error

Rich Townsend rich at u.washington.edu
Fri Aug 11 18:05:58 CEST 2006

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 [mailto:mpiktas at gmail.com] 
> Sent: Thursday, August 10, 2006 7:07 AM
> To: Frank Black
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] optim error
> Hi,
> On 8/9/06, Frank Black <fb572 at hotmail.com> 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 
> http://www.mif.vu.lt/katedros/eka/katedra/zemlys.php

More information about the R-help mailing list