[R] using optimize() correctly ...

Esmail esmail.js at gmail.com
Sun May 24 14:24:37 CEST 2009

Hello Berend,

Berend Hasselman wrote:
> Your function is not unimodal.
> The help for optimize states: 
> "If f is not unimodal, then optimize() may approximate a local, but perhaps
> non-global, minimum to the same accuracy."

Ah ok, I didn't read the manual page carefully enough.

Do you know if R has a function to find the global maximum/minimum of a
function of x over a given interval?

nlminb(), optim(), in particular the option `method = "L-BFGS-B"' or the 
function spg() in "BB" package were recommended to use if I wanted to
optimize a function over x and y given their respective intervals. Will
they also potentially only give me the local maxima/minima? I am not a
regular R user, so my knowledge is clearly not where is could/should be.


More information about the R-help mailing list