Re: [R] using optimize() correctly ...

2009-05-25 Thread Esmail
Hi Ravi! Ravi Varadhan wrote: > > Yes. Most classical optimization methods (e.g. gradient-type, > Newton-type) are "local", i.e. they do not attempt to locate the > global optimum. Ah .. I see. > The primary difficulty with global optimization is that there are no > mathematical conditions tha

Re: [R] using optimize() correctly ...

2009-05-25 Thread Esmail
Berend Hasselman wrote: If you do resopt <- optim(-5,f, method="SANN",control=list(fnscale=-1)) you will get the global maximum. SANN: simulated annealing. But starting in -4 takes you to the local maximum. So if I understand correctly, this method would also yield the same sort of result

Re: [R] using optimize() correctly ...

2009-05-24 Thread Ravi Varadhan
Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: Esmail Date: Sunday, May 24, 2009 8:27 am Subject: Re: [R] using optimize() correctly

Re: [R] using optimize() correctly ...

2009-05-24 Thread Berend Hasselman
On 24-05-2009, at 14:24, Esmail wrote: 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

Re: [R] using optimize() correctly ...

2009-05-24 Thread Esmail
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

Re: [R] using optimize() correctly ...

2009-05-23 Thread Berend Hasselman
Esmail Bonakdarian-4 wrote: > > Hi, > > I am trying to use the optimize function to optimize a function. The > results I am getting don't agree with what I compute on my own and > when I look at the graph of > > f(x) = 100 + ((x-10)**2 + (x-10)) * cos(x-10), where -10 <= x <= 10 > > in