# 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?

## marked as duplicate by whuber♦ r StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Aug 13 at 14:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• With I() you may create correlated variables. Correlated variables are bad in linear regression because they influence inference, especially if correlations are very high. – user2974951 Aug 13 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 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 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. – Isabella Ghement Aug 13 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. – Isabella Ghement Aug 13 at 14:38