Package nlmrt (function nlxb) tries to use symbolic derivatives. In fact, Duncan Murdoch and I have a very slowly developing nls14 package to substitute for nls that should advance this even further. nlxb also allows "masked" (i.e., fixed) parameters, which would let you combine your runs, fixing the fourth parameter for initial runs. It also allows bounds constraints. I suspect it should work better. I'd have tried it, but the data provided was not easily decipherable. Was it HTML format? JN On 15-06-02 06:00 AM, r-help-request at r-project.org wrote:> Message: 27 > Date: Tue, 2 Jun 2015 02:54:03 +0000 > From: <Onoriode.Coast at csiro.au> > To: <r-help at r-project.org> > Subject: [R] nls and four parameter estimates > Message-ID: > <D736F454355006429DA41754A53FFDBB43D4E817 at exmbx06-cdc.nexus.csiro.au> > Content-Type: text/plain; charset="UTF-8" > > Hello all! > > I am trying to estimate four parameters (mu, sigma, theta and lambda) of a model > Using the nls package in R, I can only get it to work if I limit the number of parameters to be estimated to three (i.e. mu, sigma and theta) as in the first model - mod1 - below. Including a fourth parameter (lambda) like in the second model - mod2 - returns the following error messages > > 1. Error in numericDeriv(form[[3L]], names(ind), env): > > 2. Missing value or an infinity produced when evaluating the model > > mod1<-nls(germ~1-(exp(-1*((psi-(theta/time)-mu)/sigma))),start=c(mu=-2.7, theta=3, sigma=3), data=ht) > mod1 > > mod2<-nls(germ~1-(exp(-1*((psi-(theta/time)-mu)/sigma)^lambda)),start=c(mu=-2.7, theta=3, sigma=3, lambda=-1.2), data=ht) > mod2 > > Please have a look at my code and tell how I might get it to work. A sample of my data is shown below. It has five levels of psi (0, -0.4, -0.8, -1.2 and -1.6). > > psi > > time > > germ > > 0 > > 1.333333