[Rd] Suggestion for the optimization code

Duncan Murdoch murdoch at stats.uwo.ca
Fri Aug 8 15:13:57 CEST 2008

On 8/8/2008 8:56 AM, Mathieu Ribatet wrote:
>     Dear list,
> Here's a suggestion about the different optimization code. There are 
> several optimization procedures in the base package (optim, optimize, 
> nlm, nlminb, ..). However, the output of these functions are slightly 
> different. For instance,
>    1. optim returns a list with arguments par (the estimates), value the
>       minimum (maxima) of the objective function, convergence (optim
>       .convergence)
>    2. optimize returns a list with arguments minimum (or maximum) giving
>       the estimates, objective the value of the obj. function
>    3. nlm returns a list with arguments minimum giving the minimum of
>       the obj. function, minimum the estimates, code the optim. convergence
>    4. nlminb returns a list with arguments par (the estimates),
>       objective, convergence (conv. code), evaluations
> Furthermore, optim keeps the names of the parameters while nlm, nlminb 
> don't.
> s
> I believe it would be nice if all these optimizers have a kind of 
> homogenized output. This will help in writing functions that can call 
> different optimizers. Obviously, we can write our own function that 
> homogenized the output after calling the optimizer, but I still believe 
> this will be more user-friendly.

Unfortunately, changing the names within the return value would break a 
lot of existing uses of those functions.  Writing a wrapper to 
homogenize the output is probably the right thing to do.

Duncan Murdoch

> Do you think this is a reasonable feature to implement - despite it 
> isn't an important point?
> Best,
> Mathieu
> * BTW, if this is relevant, I could try to do it.

More information about the R-devel mailing list