Page 355 - Applied Statistics with R
P. 355
14.2. PREDICTOR TRANSFORMATION 355
coef(fit_4c)
## (Intercept) x I(x^2) I(x^3) I(x^4)
## 2.9996256 -0.3880250 -6.1511166 0.1269046 1.0282139
unname(coef(fit_4a))
## [1] -1.980036 -2.053929 -49.344752 0.669874 20.519759
unname(coef(fit_4b))
## [1] 2.9996256 -0.3880250 -6.1511166 0.1269046 1.0282139
unname(coef(fit_4c))
## [1] 2.9996256 -0.3880250 -6.1511166 0.1269046 1.0282139
all.equal(fitted(fit_4a),
fitted(fit_4b))
## [1] TRUE
all.equal(resid(fit_4a),
resid(fit_4b))
## [1] TRUE
summary(fit_4a)
##
## Call:
## lm(formula = y ~ poly(x, degree = 4), data = data_higher)
##
## Residuals:
## Min 1Q Median 3Q Max
## -7.6982 -2.0334 0.0042 1.9532 7.4626
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.9800 0.1767 -11.205 < 2e-16 ***

