[R] NaN as a parameter in NLMINB optimization

Duncan Murdoch murdoch at stats.uwo.ca
Fri Dec 21 13:03:22 CET 2007


On 21/12/2007 12:07 AM, Rebecca Sela wrote:
> I am trying to optimize a likelihood function using NLMINB.  After running without a problem for quite a few iterations (enough that my intermediate output extends further than I can scroll back), it tries a vector of parameter values NaN.  This has happened with multiple Monte Carlo datasets, and a few different (but very similar) likelihood functions.  (They are complicated, but I can send them to someone if desired.)
> 
> Is this something that can happen with NLMINB, perhaps because of a 0/0 in the gradient calculations?  Or is it unique to my code?

I would say it's a bug. I can't tell if it's a bug in your code or in 
the nlminb code, but even if it's a problem with your code, it would be 
nice if nlminb could recognize it and give a error report rather than 
passing garbage to your function.

Can you put together a small enough example to post here?  If not, you 
could send me the full example, but I may not get to it for a couple of 
weeks.  In either case, try to make sure the error occurs on every run 
by using set.seed() and/or a fixed dataset.  If the problem is 
intermittent even with that, please let us know.

Duncan Murdoch



More information about the R-help mailing list