Re: [R] Bounding or constraining parameters in non-linear regressions

From: Douglas Bates <>
Date: Thu 09 Jun 2005 - 00:39:20 EST

On 6/7/05, <> wrote:
> Dear R-Users,
> Being an engineer and not a statistician, my desired course of action may
> either be impossible or very simple.
> I am attempting to fit a non-linear model to some measured data. One term in
> the model contains a square-root, but in the course of regression, this term
> turns negative and an error occurs. I started using Micrsoft's Excel Solver,
> and then I turned to NIST's Datplot statistical package. I can constrain in
> Solver, but it violates those constraints. :) Dataplot does not have the
> capability to constrain parameters.
> Does R have the capability to constrain or bound parameters in non-linear
> regressions?

Sort of. If you look at the stats package in r-devel you will see that a function called nlminb has been added. This function calls optimization software from the Port package ( The Fortran code for constrained nonlinear least squares problems is included in the package but the interface code for R has not yet been written. The energetic could create such interface code by emulating that for nlminb - it's not that long.

Alternatively you could use either optim or nlminb on the function which is the residual sum of squares from your model. mailing list PLEASE do read the posting guide! Received on Thu Jun 09 00:52:03 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:27 EST