# [R] difference between nlm and nlminb

Douglas Bates bates at stat.wisc.edu
Thu Jun 12 00:36:10 CEST 2008

```nlminb provides unconstrained optimization and optimization subject to
box constraints (i.e. upper and/or lower constraints on individual
elements of the parameter vector).  The nlm function provides
unconstrained optimization.

I created the nlminb function because I was unable to get reliable
convergence on some difficult optimization problems for the nlme and
lme4 packages using nlm and optim.  The nlme package was originally
written for S from Bell Labs (the forerunner of S-PLUS) and the PORT
package was the optimization code used.  Even though it is very old
style Fortran code I find it quite reliable as an optimizer.  It
allows for what is called reverse communication which is convenient in
an environment like R.  It is a technical issue that has to do with
what code is in control when your R expression needs to be evaluated.

That said, I still don't feel that I have seen good, modern
Open-Source optimization code.  I would welcome suggestions of where
one might find such code.

On Wed, Jun 11, 2008 at 3:16 AM, DavidM.UK <david.merritt at bris.ac.uk> wrote:
>
> I believe nlminb() performs *constrained* optimization, where as nlm() is for
> *unconstrained* opimization
>
> So I guess nlm() is for solving min(f[a,b]), and nlminb() min(f[a,b]) given
> a+b <= c
>
> FYI I think optim() also does constrained optimization, well I've used for
> min(f[a,b]) given a <= a* and b <= b*.
>
> David
>
>
> ae2356 wrote:
>>
>>
>> Hi,
>>
>> I was wondering if someone could give a brief, big picture overview of the
>> difference between the two optimization functions nlm and nlminb. I'm not
>> familiar with PORT routines, so I was hoping someone could give an
>> explanation.
>>
>> Thanks,
>> Angelo
>> _________________________________________________________________
>> Instantly invite friends from Facebook and other social networks to join
>> yo
>> https://www.invite2messenger.net/im/?source=TXT_EML_WLH_InviteFriends
>>       [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>
> --
> View this message in context: http://www.nabble.com/difference-between-nlm-and-nlminb-tp17769859p17772440.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help