[R] formula formatting/grammar for regression
Brigid Mooney
bkmooney at gmail.com
Fri Feb 27 17:15:50 CET 2009
Hi all,
I am doing some basic regression analysis, and am getting a bit
confused on how to enter non-polynomial formulas to be used.
For example, consider that I want to find A and r such that the
formula y = A*exp(r*x) provides the the best fit to the line y=x on
the interval [0,50].
I can set:
xpts <- seq(0, 50, by=0.1)
ypts <- seq(0, 50, by=0.1)
I know I can find a fitted polynomial of a given degree using
lm(ypts ~ poly(xpts, degree=5, raw=TRUE))
But am confused on what the formula should be for trying to find a fit
to y = A*exp(r*x).
If anyone knows of a resource that describes the "grammar" behind
assembling these formulas, I would really appreciate being pointed in
that direction as I can't seem to find much beyond basic polynomials.
Thanks for the help!
More information about the R-help
mailing list