[R] Intercept Coefficient in a Model with Orthogonal Polynomials
Chuck Cleland
ccleland at optonline.net
Mon Apr 30 22:41:24 CEST 2007
This very likely falls in the category of an unexpected result due to
user ignorance. I generated the following data:
time <- 0:10
set.seed(4302007)
y <- 268 + -9*time + .4*(time^2) + rnorm(11, 0, .1)
I then fit models using both orthogonal and raw polynomials:
fit1 <- lm(y ~ poly(time, 2))
fit2 <- lm(y ~ poly(time, degree=2, raw=TRUE))
> predict(fit1, data.frame(time = 0:10))
1 2 3 4 5 6 7
268.1339 259.4912 251.6542 244.6230 238.3976 232.9780 228.3642
8 9 10 11
224.5562 221.5540 219.3575 217.9669
> predict(fit2, data.frame(time = 0:10))
1 2 3 4 5 6 7
268.1339 259.4912 251.6542 244.6230 238.3976 232.9780 228.3642
8 9 10 11
224.5562 221.5540 219.3575 217.9669
> coef(fit1)
(Intercept) poly(time, 2)1 poly(time, 2)2
237.00698 -52.61565 11.80144
> coef(fit2)
(Intercept)
268.1339235
poly(time, degree = 2, raw = TRUE)1
-9.0456491
poly(time, degree = 2, raw = TRUE)2
0.4028944
I expected the intercept coefficient in the model with orthogonal
polynomials to correspond to the predicted value of y when time=5.
Instead, it seems to correspond to y at time between time=4 and time=5.
Is there a way of figuring out what time the intercept corresponds to
on the original time scale (0:10 here)? Any comments and pointers to
references would be greatly appreciated.
thanks,
Chuck Cleland
--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894
More information about the R-help
mailing list