Skip to content
Prev 180139 / 398525 Next

curve fitting

or use nls.lm as in

install.packages("minpack.lm")
library(minpack.lm)

x <- c(2, 8, 14, 20, 26, 32, 38, 44, 50, 56, 62, 68, 74)
y <- c(100, 99, 99, 98, 97, 94, 82, 66, 48, 38, 22, 10, 1)

res <- function(p, x, y) y - ff(p,x)
ff <- function(p, x) 100*exp(p[1]*(1-exp(p[2]*x))/p[2])
aa <- nls.lm(par=c(.0001,.0001), fn=res, x=x, y=y)

plot(x,y)
lines(x, ff(coef(aa), x))
On Tue, 12 May 2009, Jorge Ivan Velez wrote: