最初に確認したいのは、著者が生の多項式と直交多項式について話しているかどうかです。
直交多項式の場合。係数は「大きく」なりません。
2次および15次の多項式展開の2つの例を示します。最初に、2次展開の係数を示します。
summary(lm(mpg~poly(wt,2),mtcars))
Call:
lm(formula = mpg ~ poly(wt, 2), data = mtcars)
Residuals:
Min 1Q Median 3Q Max
-3.483 -1.998 -0.773 1.462 6.238
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 20.0906 0.4686 42.877 < 2e-16 ***
poly(wt, 2)1 -29.1157 2.6506 -10.985 7.52e-12 ***
poly(wt, 2)2 8.6358 2.6506 3.258 0.00286 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.651 on 29 degrees of freedom
Multiple R-squared: 0.8191, Adjusted R-squared: 0.8066
F-statistic: 65.64 on 2 and 29 DF, p-value: 1.715e-11
次に、15次を表示します。
summary(lm(mpg~poly(wt,15),mtcars))
Call:
lm(formula = mpg ~ poly(wt, 15), data = mtcars)
Residuals:
Min 1Q Median 3Q Max
-5.3233 -0.4641 0.0072 0.6401 4.0394
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 20.0906 0.4551 44.147 < 2e-16 ***
poly(wt, 15)1 -29.1157 2.5743 -11.310 4.83e-09 ***
poly(wt, 15)2 8.6358 2.5743 3.355 0.00403 **
poly(wt, 15)3 0.2749 2.5743 0.107 0.91629
poly(wt, 15)4 -1.7891 2.5743 -0.695 0.49705
poly(wt, 15)5 1.8797 2.5743 0.730 0.47584
poly(wt, 15)6 -2.8354 2.5743 -1.101 0.28702
poly(wt, 15)7 2.5613 2.5743 0.995 0.33459
poly(wt, 15)8 1.5772 2.5743 0.613 0.54872
poly(wt, 15)9 -5.2412 2.5743 -2.036 0.05866 .
poly(wt, 15)10 -2.4959 2.5743 -0.970 0.34672
poly(wt, 15)11 2.5007 2.5743 0.971 0.34580
poly(wt, 15)12 2.4263 2.5743 0.942 0.35996
poly(wt, 15)13 -2.0134 2.5743 -0.782 0.44559
poly(wt, 15)14 3.3994 2.5743 1.320 0.20525
poly(wt, 15)15 -3.5161 2.5743 -1.366 0.19089
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.574 on 16 degrees of freedom
Multiple R-squared: 0.9058, Adjusted R-squared: 0.8176
F-statistic: 10.26 on 15 and 16 DF, p-value: 1.558e-05
直交多項式を使用しているため、低次の係数は高次の結果の対応する項とまったく同じであることに注意してください。たとえば、1次の切片と係数は、両方のモデルで20.09と-29.11です。
106
> summary(lm(mpg~poly(wt,15, raw=T),mtcars))
Call:
lm(formula = mpg ~ poly(wt, 15, raw = T), data = mtcars)
Residuals:
Min 1Q Median 3Q Max
-5.6217 -0.7544 0.0306 1.1678 5.4308
Coefficients: (3 not defined because of singularities)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.287e+05 9.991e+05 0.629 0.537
poly(wt, 15, raw = T)1 -2.713e+06 4.195e+06 -0.647 0.526
poly(wt, 15, raw = T)2 5.246e+06 7.893e+06 0.665 0.514
poly(wt, 15, raw = T)3 -6.001e+06 8.784e+06 -0.683 0.503
poly(wt, 15, raw = T)4 4.512e+06 6.427e+06 0.702 0.491
poly(wt, 15, raw = T)5 -2.340e+06 3.246e+06 -0.721 0.480
poly(wt, 15, raw = T)6 8.537e+05 1.154e+06 0.740 0.468
poly(wt, 15, raw = T)7 -2.184e+05 2.880e+05 -0.758 0.458
poly(wt, 15, raw = T)8 3.809e+04 4.910e+04 0.776 0.447
poly(wt, 15, raw = T)9 -4.212e+03 5.314e+03 -0.793 0.438
poly(wt, 15, raw = T)10 2.382e+02 2.947e+02 0.809 0.429
poly(wt, 15, raw = T)11 NA NA NA NA
poly(wt, 15, raw = T)12 -5.642e-01 6.742e-01 -0.837 0.413
poly(wt, 15, raw = T)13 NA NA NA NA
poly(wt, 15, raw = T)14 NA NA NA NA
poly(wt, 15, raw = T)15 1.259e-04 1.447e-04 0.870 0.395
Residual standard error: 2.659 on 19 degrees of freedom
Multiple R-squared: 0.8807, Adjusted R-squared: 0.8053
F-statistic: 11.68 on 12 and 19 DF, p-value: 2.362e-06