[R] Curve Fitting Question - Newbie

C Grant cgrant02589 at yahoo.com
Wed Jan 29 00:40:03 CET 2003


Hello, I have what should be an easy question. I'm a
new r user and making the transition from menus to the
command line so as to do batch processing of tons of
data. One of my data streams needs to be detrended.
It's a vector of numbers that follows a negative
exponential decay. I need to fit a curve to it and use
the residuals as an object. The data looks something
like this:

foo.dat <- (0.83 * exp(-0.017 * 1:1000) + 0.5) +
rnorm(1000,0,0.05)
plot(foo.dat, type = "l")

That is an example the parameters for foo.dat change
slightly. So, I need to fit a neg exponential curve to
that type of data without specifying the parameters
beforehand and save the residuals as an object. It
will have to accomadate being in a loop.

How can I do this?

Regards, CG




More information about the R-help mailing list