> >> fit<-nls(d$time~a1*exp(b1*d$age) + > > a2*exp(b2*d$age)+c > > ,start(a1=10,b1=0,a2=250,b2=1,c=0) > > This line should read: start=list(a1=10,b1=0,a2=250,b2=1,c=0)
After you fix that you will run into another problem Error in nls(d$time ~ a1 * exp(b1 * d$age) + a2 * exp(b2 * d$age) + c, : parameters without starting value in 'data': age Instead of using d$time and d$age, use data=d and just time and age: fit<-nls(data=d, time~a1*exp(b1*age) + a2*exp(b2*age)+c ,start=list(a1=10,b1=0,a2=250,b2=1,c=0) ,trace=T) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Berend Hasselman > Sent: Friday, October 25, 2013 9:54 PM > To: Tom Wright > Cc: r-h...@stat.math.ethz.ch > Subject: Re: [R] problem fitting 2 term exponential with nls > > > On 25-10-2013, at 17:29, Tom Wright <t...@maladmin.com> wrote: > > > Hi, > > Can anyone explain why the nls function is giving an error? > > Thanks > > Tom > > > >> head(d) > > age time > > 1 23.566667 223.0 > > 2 42.633333 223.0 > > 3 62.300000 222.0 > > 4 32.933333 220.5 > > 5 9.366667 228.0 > > 6 23.833333 227.0 > > > >> fit<-nls(d$time~a1*exp(b1*d$age) + > > a2*exp(b2*d$age)+c > > ,start(a1=10,b1=0,a2=250,b2=1,c=0) > > This line should read: start=list(a1=10,b1=0,a2=250,b2=1,c=0) > > Berend > > > ,trace=T) > > Error in hasTsp(x) : argument "x" is missing, with no default > > > > ______________________________________________ > > R-help@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. > > ______________________________________________ > R-help@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. ______________________________________________ R-help@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.