[R] use of poly()

Dylan Beaudette dylan.beaudette at gmail.com
Wed Feb 13 21:41:38 CET 2008


Hi,

I am curious about how to interpret the results of a polynomial regression-- 
using poly(raw=TRUE) vs. poly(raw=FALSE).

set.seed(123456)
x <- rnorm(100)
y <- jitter(1*x + 2*x^2 + 3*x^3 , 250)
plot(y ~ x)

l.poly <- lm(y ~ poly(x, 3))
l.poly.raw <- lm(y ~ poly(x, 3, raw=TRUE))

s <- seq(-3, 3, by=0.1)

lines(s, predict(l.poly, data.frame(x=s)), col=1)
lines(s, predict(l.poly.raw, data.frame(x=s)), col=2)

The results are the same, but the regression coeficients are different:

as.vector(coef(l.poly))
1.806618 88.078858 16.194423 58.051642

as.vector(coef(l.poly.raw))
-0.1025114  1.5265248  2.0617970  2.7393995


When using continuous data in both Y and X, does the difference between "raw" 
and "orthagonal" polynomials have any practical meaning?

Thanks,

Dylan



-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341



More information about the R-help mailing list