# [R] using optimize() correctly ...

Sun May 24 15:32:13 CEST 2009

```Yes.  Most classical optimization methods (e.g. gradient-type, Newton-type) are "local", i.e. they do not attempt to locate the global optimum.  The primary difficulty with global optimization is that there are no mathematical conditions that characterize global optimum in multi-modal problems.  For local optimum, you have the first- and second-order Kuhn-Tucker conditions.  A simplistic strategy to find global optimum is to use local methods with multiple starting values.  Again the problem is that you don't haev any guarantee that you have found the global optimum.  The larger the number of starting values, the greater your chances of finding the global optimum.  There are more principled strategies than the random multi-start approach, but even they are not guaranteed to work.

Ravi.

____________________________________________________________________

Assistant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University

Ph. (410) 502-2619

----- Original Message -----
From: Esmail <esmail.js at gmail.com>
Date: Sunday, May 24, 2009 8:27 am
Subject: Re: [R] using optimize() correctly ...
To: Berend Hasselman <bhh at xs4all.nl>
Cc: r-help at r-project.org

> 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.
>
>  Thanks,
>  Esmail
>
>  ______________________________________________
>  R-help at r-project.org mailing list
>