Re: [R] r's optim vs. matlab's fminsearch

From: Anthony Bishara <abishara_at_indiana.edu>
Date: Tue 13 Jun 2006 - 05:00:24 EST

        Thanks for the feedback. I should've mentioned before that the function is non-smooth. Also, it has a 3-element free parameter vector, and I've been using a grid of 27 vectors of starting parameters.

Anthony

-----Original Message-----
From: Prof Brian Ripley [mailto:ripley@stats.ox.ac.uk] Sent: Monday, June 12, 2006 1:40 PM
To: Anthony Bishara
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] r's optim vs. matlab's fminsearch

Unless you know the function to be non-smooth, I suggest you use method="BFGS" in R.

BTW, all such algorithms are only designed to find local minima, and so the choice of starting point may be crucial.

On Mon, 12 Jun 2006, Anthony Bishara wrote:

> Hi,
> I'm having a problem converting a Matlab program into R. The R code works
> almost all the time, but about 4% of the time R's optim function gets
stuck
> on a local minimum whereas matlab's fminsearch function does not (or at
> least fminsearch finds a better minimum than optim). My understanding is
> that both functions default to Nelder-Mead optimization, but what's
> different about the two functions? Below, I've pasted the relevant
default
> options I could find. Are there other options I should to consider? Does
> Matlab have default settings for reflection, contraction, and expansion,
and
> if so what are they? Are there other reasons optim and fminsearch might
> work differently?
> Thanks.
>
> ***Matlab's fminsearch defaults***
> MaxFunEvals: '200*numberofvariables'
> MaxIter: '200*numberofvariables'
> TolFun: 1.0000e-004 #Termination tolerance on the function
> value.
> TolX: 1.0000e-004 #Termination tolerance on x.
>
> ***R's optim defaults (for Nelder-Mead)***
> maxit=500
> reltol=1e-8
> alpha=1.0 #Reflection
> beta=.5 #Contraction
> gamma=2.0 #Expansion
>
>
> Anthony J. Bishara
> Post-Doctoral Fellow
> Department of Psychological & Brain Sciences
> Indiana University
> 1101 E. Tenth St.
> Bloomington, IN 47405
> (812)856-4678
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Tue Jun 13 05:03:26 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 13 Jun 2006 - 06:12:23 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.