[R] how to define the bound between parameters in nls() (Jinsong Zhao)

John C Nash nashjc at uottawa.ca
Fri Nov 18 15:02:13 CET 2011


The multiple exponential problem you are attempting has a well-known and long history.
Lanczos 1956 book showed that changing the 4th decimal in a data set changes the
parameters hugely.

Nevertheless, if you just need a "fit" and not reliable paramters, you could
reparameterize to k1 and k2diff=k2-k1, so k2=k1+kdiff. Then kdiff has a lower bound of 0,
though putting 0 will almost certainly get you into computational trouble. You probably
want an upper bound on k1 too. The problem is discussed in the book I published with Mary
Walker-Smith in 1987, but I think our treatment is still only an expedient. Note that the
software was in BASIC, but it still runs (DOSBOX is a friend for Linux users). That book
can be obtained free from  http://macnash.telfer.uottawa.ca/nlpe/.

Best, JN



On 11/18/2011 06:00 AM, r-help-request at r-project.org wrote:
> Message: 4
> Date: Thu, 17 Nov 2011 20:42:12 +0800
> From: Jinsong Zhao <jszhao at yeah.net>
> To: "r-help at r-project.org" <r-help at r-project.org>
> Subject: [R] how to define the bound between parameters in nls()
> Message-ID: <4EC50124.309 at yeah.net>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> Hi there,
> 
> I have read the help page of nls(), there is lower or upper for defining 
> the bounds of parameters. For example,
> 
> nls(y ~ 1-a*exp(-k1*x)-(1-a)*exp(-k2*x), data=data.1, start=list(a=0.02, 
> k1=0.01, k2=0.0004), upper=c(1,1,1), lower=c(0,0,0))
> 
> I hope to define k1 > k2, but I don't find a way.
> 
> Any suggestions will be really appreciated.
> 
> Regards,
> Jinsong
> 
> 
>



More information about the R-help mailing list