Skip to content
Prev 205726 / 398506 Next

Polynomial equation

Hi Chris,

You can use lm with poly (look ?lm, ?poly).
If x and y are your arrays of points and you wish to fit a polynom of degree 4, say, enter:  model <- lm(y~poly(x,4,raw=TRUE) and then summary(model)
The raw=TRUE causes poly to use 1,x,x^2,x^3,... instead of orthogonal polynomials (which are "better" numerically but may be not what you need).

Regards,
Moshe.
--- On Fri, 8/1/10, chrisli1223 <chrisli at austwaterenv.com.au> wrote: