Re: [Rd] Bug in optim for specific orders of magnitude

2023-01-03 Thread GILLIBERT, Andre
J C Nash wrote: > Extreme scaling quite often ruins optimization calculations. If you think > available methods are capable of doing this, there's a bridge I can sell you > in NYC. Given that optim()seems to have problem with denormals but work correctly with values greater than 1e-308, I thin

Re: [Rd] Bug in optim for specific orders of magnitude

2022-12-26 Thread Brodie Gaslam via R-devel
FWIW, I suspect the problem might have something to do with: > 1/1e-308 [1] 1e+308 > 1/1e-309 [1] Inf > 1e-309 > 0 [1] TRUE > 1e-324 > 0 [1] FALSE That is 1e-309 starts being treated as zero by division, but not by comparison (which happens at 1e-324).  This is not quite the range of values you

Re: [Rd] Bug in optim for specific orders of magnitude

2022-12-26 Thread Collin Erickson
Thanks for all of your replies. I would like to clarify that I am not expecting optim to return a good result in these cases, as I am aware of the difficulties that come with the numerical precision for such small numbers. I would be happy for optim to take zero steps and return the initial value

Re: [Rd] Bug in optim for specific orders of magnitude

2022-12-23 Thread Duncan Murdoch
The optim help page mentions scaling in the discussion of the "control" argument. Specifically under the parscale description: "Optimization is performed on par/parscale and these should be comparable in the sense that a unit change in any element produces about a unit change in the scaled va

Re: [Rd] Bug in optim for specific orders of magnitude

2022-12-23 Thread J C Nash
Extreme scaling quite often ruins optimization calculations. If you think available methods are capable of doing this, there's a bridge I can sell you in NYC. I've been trying for some years to develop a good check on scaling so I can tell users who provide functions like this to send (lots of)

Re: [Rd] Bug in optim for specific orders of magnitude

2022-12-23 Thread Steven Dirkse
Collin, It is interesting that you get such strange results when passing denormal values to optim(). Several possibilities for this spring to mind. A better question though might be, "What kind of results are you expecting when you pass such small values to optim()?" In general, you shouldn't h

Re: [Rd] Bug in optim for specific orders of magnitude

2022-12-23 Thread Rui Barradas
Às 17:30 de 23/12/2022, Collin Erickson escreveu: Hello, I've come across what seems to be a bug in optim that has become a nuisance for me. To recreate the bug, run: optim(c(0,0), function(x) {x[1]*1e-317}, lower=c(-1,-1), upper=c(1,1), method='L-BFGS-B') The error message says: Error in op

[Rd] Bug in optim for specific orders of magnitude

2022-12-23 Thread Collin Erickson
Hello, I've come across what seems to be a bug in optim that has become a nuisance for me. To recreate the bug, run: optim(c(0,0), function(x) {x[1]*1e-317}, lower=c(-1,-1), upper=c(1,1), method='L-BFGS-B') The error message says: Error in optim(c(0, 0), function(x) { : non-finite value supp