# Why prefer poly() to I() ? Are they different? [duplicate]

A post "Fitting Polynomial Regression in R" used two ways to model the polynomial regression: (a) poly(..., ...); (b) I(...). Below is the example:

set.seed(20)
q <- seq(from=0, to=20, by=0.1)
y <- 500 + 0.4 * (q-10)^3
noise <- rnorm(length(q), mean=10, sd=80)
noisy.y <- y + noise

# fitting polynomials
#     two methods
model_a <- lm(noisy.y ~ poly(q,3))
model_b <- lm(noisy.y ~ q + I(q^2) + I(q^3))
# their summary are all the same except the coefficients
summary(model_a)
summary(model_b)


The post said that:

q, I(q^2) and I(q^3) will be correlated and correlated variables can cause problems. The use of poly() lets you avoid this by producing orthogonal polynomials, therefore I’m going to use the first option (i.e., poly()).

I am confused that:

(1) Why does the q, I(q^2) and I(q^3) cause problems?

(2) According to summary(), these two models are all the same, except the Coefficients . Why the coefficients are different, while others are the same? Shouldn't they all different, or all the same?

• With I() you may create correlated variables. Correlated variables are bad in linear regression because they influence inference, especially if correlations are very high. Aug 13, 2019 at 14:02
• @user2974951 But why the summary of model_a and model_b is "nearly" the same? I mean, if the I() method introduced correlations, I guess their numerical output will be totally different.
– T X
Aug 13, 2019 at 14:12
• Did you consider searching our site for "poly"? The link goes to a very limited search to help you focus on relevant threads.
– whuber
Aug 13, 2019 at 14:12
• poly() is more flexible than using I. If you use poly() with the option raw = TRUE, your model will include raw polynomial terms - same as using I(). If you use poly() with the option raw = FALSE (which is the default in R), your model will include orthogonal polynomial terms. Note that poly() also has a degree option, which allows for the control of the polynomial degree. When using raw polynomials as your predictors (e.g., I(X), I(X^2), I(X^2)), collinearity among these predictors is likely to be an issue. Aug 13, 2019 at 14:30
• Some people may center the predictor X around its observed mean in the data and then include raw polynomial terms of the centered X in their model. While this alleviates some of the collinearity among the raw polynomial terms, it doesn't fully resolve collinearity. One of the approaches often suggested to reduce collinearity is carrying out the modelling with orthogonal polynomials. Aug 13, 2019 at 14:38