[R] Generating a best fit line for non linear data

From: BornSurvivor <lak13_at_geneseo.edu>
Date: Thu, 28 Apr 2011 13:56:43 -0700 (PDT)

I have the following data set, and I have to find the line of best fit using this equation,
y = a*(1 - exp(-b*x)).

samples = seq(1,20,by=1)
species = c(5,8,9,9,11,11,12,15,17,19,20,20,21,23,23,25,25,27,27,27) plot(samples,species, main = "Accumulation Curve for Tree Species Richness", xlab = "Samples", ylab = "Number of Species") curve((y = 27*(1 - exp(-.15*x))),from=0,to=20,add = T)

I tried to find the best fit curve using:

fit = nls(species ~ a *(1 - exp(-b*x)),start = list(a = 27, b = .15)

but I get a "parameters without starting value in 'data': x" and I don't have any idea what this means, or how to fix the above code.

View this message in context: http://r.789695.n4.nabble.com/Generating-a-best-fit-line-for-non-linear-data-tp3482193p3482193.html
Sent from the R help mailing list archive at Nabble.com.

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 29 Apr 2011 - 01:35:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 29 Apr 2011 - 02:00:35 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive