[R] nls not solving

Bert Gunter gunter.berton at gene.com
Mon Feb 28 22:42:18 CET 2011


Well, since no one else has replied, let me state the obvious: The
model is nonidentifiable.  It is of the form:

y = a + b(1 - exp(kl)) - b exp(-kx)

Suppose you have a solution. Suppose with your solution, a + b(1
-exp(kl)) = C, say. Then a = C - b(1-exp(kl)). Hence you have
generated an infinite number of pairs <a,l> by solving for one in
terms of the other that give the exact same solution. That is, the
model is nonidentifiable. Whence your error. Removing "a" or "l" makes
the model identifiable.

-- Bert



On Mon, Feb 28, 2011 at 12:23 PM, Schatzi <adele_thompson at cargill.com> wrote:
> I am running the following nls equation. I tried it with data that excel was
> fitting and got the error:
> singular gradient matrix at initial parameter estimates
> I thought it was due to a low number of points (6), but when I create a
> dataset, I get the same problem. If I remove the parameter "a," then it can
> find a solution. Does anyone know what I can do to fit this model?
>
> vardata<- rnorm(73,mean=0,sd=5)
> x<-0:72
> a<-1
> b<-50
> k<-0.05
> l<-5
> startt<-c(a,b,k,l)
> yf<-a+b*(1-exp(-k*(x-l)))
> y<-yf+vardata
>
> nmodel<-nls(y~a+b*(1-exp(-k*(x-l))),
> start=list(a=1,b=50,k=0.05,l=5))
>
> --
> View this message in context: http://r.789695.n4.nabble.com/nls-not-solving-tp3328647p3328647.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>



-- 
Bert Gunter
Genentech Nonclinical Biostatistics



More information about the R-help mailing list