[R] Not nice behaviour of nlminb (windows 32 bit, version, 2.11.1)

Duncan Murdoch murdoch.duncan at gmail.com
Sun Jul 11 14:02:38 CEST 2010


On 10/07/2010 9:48 AM, Prof. John C Nash wrote:
> I won't add to the quite long discussion about the vagaries of nlminb, but will note that 
> over a long period of software work in this optimization area I've found a number of 
> programs and packages that do strange things when the objective is a function of a single 
> parameter. Some methods quite explicitly throw an error when n<2. It seems nlminb does 
> not, but that does not mean that the authors ever thought anyone would use their large 
> package to solve a small 1D problem, or if they did, whether they seriously tested for the 
> awkward things that happen when one only has one parameter. I've seen similar things go 
> wrong with matrix packages e.g., eigensolutions of 1 by 1 matrices.
>
> So this msg is to watch carefully when problems are n=1 and put in some checks that 
> answers make sense.


This has nothing to do with n=1. 

nlminb(obj = function(x) sum(x^2)-25, start = c(0,6))

fails as badly as all the other examples.  The problem is the 
(unintended?) assumption in nlminb, and possibly in the PORT library it 
uses, that f(x) is non-negative, so a vector x where f(x) = 0 is 
guaranteed to be a solution.

Duncan Murdoch



More information about the R-help mailing list