nls and four parameter estimates

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

nls and four parameter estimates

Onoriode.Coast
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

0

0

1.416667

0

0

1.5

0.04

0

1.583333

0.04

0

2.083333

0.08

0

2.166667

0.16

0

2.25

0.24

0

2.583333

0.64

0

2.666667

0.72

0

2.916667

1

.
.
.
-1.6

2.916667

0

-1.6

3.166667

0

-1.6

3.666667

0

-1.6

7.666667

0

-1.6

9.666667

0

-1.6

12.66667

0

-1.6

19.66667

0


Dr Onoriode Coast
Postdoctoral Fellow
Agriculture Flagship
CSIRO
E [hidden email] T +61 2 6799 1541 M 0477 386 110
21888 Kamilaroi Highway, Narrabri, NSW, 2390 Australia
www.csiro.au

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: nls and four parameter estimates

Prof J C Nash (U30A)
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, [hidden email] wrote:

> Message: 27
> Date: Tue, 2 Jun 2015 02:54:03 +0000
> From: <[hidden email]>
> To: <[hidden email]>
> Subject: [R] nls and four parameter estimates
> Message-ID:
> <[hidden email]>
> 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

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.