[R] Bounding or constraining parameters in non-linear regressions
Douglas Bates
dmbates at gmail.com
Wed Jun 8 16:39:20 CEST 2005
On 6/7/05, mwdavis at nist.gov <mwdavis at nist.gov> 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
(http://www.netlib.com/port/). 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.
More information about the R-help
mailing list