統計学 における多項式回帰 (たこうしきかいき、英 : polynomial regression )とは、従属変数
y
{\displaystyle y}
を独立変数
x
{\displaystyle x}
の
n
{\displaystyle n}
次多項式 でモデル化する回帰分析 の一手法である。多項式回帰は、従属変数と独立変数とが非線形 的な関係で表現されるような場合に適しており、例えば神経組織の成長[ 1] 、湖底堆積物中の炭素同位体の分布[ 2] 、感染症の拡大[ 3] の記述に用いられてきた。多項式回帰ではデータに非線形なモデルを当てはめるが、推定理論 (英語版 ) においては線形の問題に分類される。というのも、推定される関数が未知母数 の1次式だからである。この意味で、多項式回帰は重回帰分析 の特別な場合とみなされる。
"ベースライン"変数
x
{\displaystyle x}
のべき乗によって得られる説明変数(独立変数)は高次項と呼ばれる。このような項は統計的分類 の問題にも現れることがある[ 4] 。
歴史
多項式回帰では、普通最小二乗法 を用いてモデルの当てはめが行われ、これにより偏回帰係数の最小分散不偏推定量が求まる(ガウス=マルコフの定理 )。最小二乗法は1805年にルジャンドル 、1809年にガウス によって発表された。多項式回帰を用いた最初の実験計画 の例がジョセフ・ディエ・ジェルゴンヌ (英語版 、フランス語版 ) の1815年の論文に見られる[ 5] [ 6] 。20世紀になって回帰分析 が発達し、実験計画法や推定の理論の問題が重要視される中で、多項式回帰は大きな役割を果たしてきた[ 7] 。
定義と例
シミュレーションデータセットに3次多項式の回帰曲線を当てはめた例。95%同時信頼区間 はシェッフェの方法 によって構築されている。
回帰分析の目的は、従属変数
y
{\displaystyle y}
を独立変数
x
{\displaystyle x}
で説明するモデルを作ることである。単回帰 (英語版 ) ではモデルは
y
=
β
0
+
β
1
x
+
ε
{\displaystyle y=\beta _{0}+\beta _{1}x+\varepsilon }
となる。ここで
ε
{\displaystyle \varepsilon }
は平均が0になるような偶然誤差。このモデルでは、変数
x
{\displaystyle x}
が1単位増加するのに伴って
y
{\displaystyle y}
は
β
1
{\displaystyle \beta _{1}}
だけ増加する。
多くの場面で、このような線形の関係は成り立たなくなる。例えば、化学合成における収率 と温度との関係を調べると、温度1単位の上昇に伴い収率が加速度的に向上することがある。この場合、モデルに2次式を用いることが考えられる。
y
=
β
0
+
β
1
x
+
β
2
x
2
+
ε
{\displaystyle y=\beta _{0}+\beta _{1}x+\beta _{2}x^{2}+\varepsilon }
このモデルでは、温度が
x
{\displaystyle x}
から
x
+
1
{\displaystyle x+1}
に1単位上昇すると、収率は平均して
β
1
+
β
2
(
2
x
+
1
)
{\displaystyle \beta _{1}+\beta _{2}(2x+1)}
だけ増加し(
x
{\displaystyle x}
を
x
+
1
{\displaystyle x+1}
で置き換えて差し引く)、また微小変動
Δ
x
{\displaystyle \Delta x}
による
y
{\displaystyle y}
の全変動は
(
β
1
+
2
β
2
x
)
Δ
x
{\displaystyle (\beta _{1}+2\beta _{2}x)\Delta x}
である。収率の変化量が
x
{\displaystyle x}
に依存しているのは非線形性の現れである。
より一般には n 次多項式を用いることができ、これが多項式回帰のモデルである。
y
=
β
0
+
β
1
x
+
β
2
x
2
+
β
3
x
3
+
⋯
+
β
n
x
n
+
ε
{\displaystyle y=\beta _{0}+\beta _{1}x+\beta _{2}x^{2}+\beta _{3}x^{3}+\cdots +\beta _{n}x^{n}+\varepsilon }
行列を用いた記法と推定値の計算
多項式モデル
y
i
=
β
0
+
β
1
x
i
+
β
2
x
i
2
+
⋯
+
β
n
x
i
n
+
ε
i
(
i
=
1
,
2
,
…
,
m
)
{\displaystyle y_{i}\,=\,\beta _{0}+\beta _{1}x_{i}+\beta _{2}x_{i}^{2}+\cdots +\beta _{n}x_{i}^{n}+\varepsilon _{i}\ (i=1,2,\dots ,m)}
は、計画行列
X
{\displaystyle \mathbf {X} }
、従属変数ベクトル
y
→
{\displaystyle {\vec {y}}}
、母数ベクトル
β
→
{\displaystyle {\vec {\beta }}}
、誤差ベクトル
ε
→
{\displaystyle {\vec {\varepsilon }}}
を使って行列の形で表現できる。
X
{\displaystyle \mathbf {X} }
の第
i
{\displaystyle i}
行目と
y
→
{\displaystyle {\vec {y}}}
の第
i
{\displaystyle i}
成分は、第
i
{\displaystyle i}
番目のサンプルデータにおける
x
{\displaystyle x}
と
y
{\displaystyle y}
の値から成っている。全体としては次のように1次方程式の系として書ける:
[
y
1
y
2
y
3
⋮
y
m
]
=
[
1
x
1
x
1
2
…
x
1
n
1
x
2
x
2
2
…
x
2
n
1
x
3
x
3
2
…
x
3
n
⋮
⋮
⋮
⋱
⋮
1
x
m
x
m
2
…
x
m
n
]
[
β
0
β
1
β
2
⋮
β
n
]
+
[
ε
1
ε
2
ε
3
⋮
ε
m
]
{\displaystyle {\begin{bmatrix}y_{1}\\y_{2}\\y_{3}\\\vdots \\y_{m}\end{bmatrix}}={\begin{bmatrix}1&x_{1}&x_{1}^{2}&\dots &x_{1}^{n}\\1&x_{2}&x_{2}^{2}&\dots &x_{2}^{n}\\1&x_{3}&x_{3}^{2}&\dots &x_{3}^{n}\\\vdots &\vdots &\vdots &\ddots &\vdots \\1&x_{m}&x_{m}^{2}&\dots &x_{m}^{n}\end{bmatrix}}{\begin{bmatrix}\beta _{0}\\\beta _{1}\\\beta _{2}\\\vdots \\\beta _{n}\end{bmatrix}}+{\begin{bmatrix}\varepsilon _{1}\\\varepsilon _{2}\\\varepsilon _{3}\\\vdots \\\varepsilon _{m}\end{bmatrix}}}
行列だけで書くと次のようになる。
y
→
=
X
β
→
+
ε
→
{\displaystyle {\vec {y}}=\mathbf {X} {\vec {\beta }}+{\vec {\varepsilon }}}
ここで、相異なる
n
+
1
{\displaystyle n+1}
個(=未知母数の個数)以上の
x
{\displaystyle x}
に対するサンプルが得られているとする(
m
≥
n
+
1
{\displaystyle m\geq n+1}
)。このとき行列
X
{\displaystyle \mathbf {X} }
はヴァンデルモンドの行列式 を与える正方行列を小行列 として持つため、階数は最大値である
n
+
1
{\displaystyle n+1}
となる。行列の一般論から
X
T
X
{\displaystyle \mathbf {X} ^{\mathsf {T}}\mathbf {X} }
の階数も
n
+
1
{\displaystyle n+1}
になり(QR分解 を参照)、
X
T
X
{\displaystyle \mathbf {X} ^{\mathsf {T}}\mathbf {X} }
は逆行列を持つ。
よって最小二乗法の一般論から、回帰係数の推定量は
β
→
^
=
(
X
T
X
)
−
1
X
T
y
→
{\displaystyle {\widehat {\vec {\beta }}}=(\mathbf {X} ^{\mathsf {T}}\mathbf {X} )^{-1}\;\mathbf {X} ^{\mathsf {T}}{\vec {y}}}
と一意的に求められる。
解釈
多項式回帰は技術的には重回帰の一種ではあるが、当てはめられた多項式の解釈にはやや異なった視点が必要である。
x
,
x
2
,
…
,
x
n
{\displaystyle x,x^{2},\ldots ,x^{n}}
は強く相関しているため、それらの回帰係数を個別に解釈するのは難しいことが多い。例えば
x
{\displaystyle x}
と
x
2
{\displaystyle x^{2}}
は、
x
{\displaystyle x}
が区間 (0, 1) 上の一様分布 に従っているなら相関係数が 0.97 である。直交多項式 を使うことで相関を減少させることもできるが、当てはめた関数を全体として捉えるほうが示唆的である。各点での信頼区間・同時信頼区間は回帰関数の不確かさを表す。
代替するアプローチ
多項式回帰は、2つの量の関係を何らかの基底関数 (この場合は独立変数の有限個のべき乗)で表現する回帰手法の一例である。難点は、べき乗項の非線形性から、ある点
x
0
{\displaystyle x_{0}}
での予測値が遠く離れた点
x
{\displaystyle x}
でのサンプルデータの影響を強く受けてしまうことである[ 8] 。近年では、多項式回帰に別の基底関数、例えば、スプライン 、放射基底関数 、ウェーブレット 等を組み合わせることもある。こうした関数族を使うことで、より少ない関数だけから多様なデータに当てはまる回帰関数を作れることがある。
多項式回帰の目的は独立変数と従属変数の間の非線形な関係をモデル化することである。これは非線形な回帰関係を捉えようとするノンパラメトリック回帰 (英語版 ) の目標とも重なるところがあり、ノンパラメトリック回帰での平滑化 (英語版 ) 等の手法は多項式回帰の有力な代替になり得る。これらの手法の中には、局所的な形式での多項式回帰を利用するものもある[ 9] 。従来型の多項式回帰の長所は、推測のフレームワークが活用できることである(これは他の基底関数、例えばスプラインを使う場合にも当てはまる)。
残る代替手法として、カーネル法によるもの(例えば、多項式カーネル (英語版 ) を用いたサポートベクターマシン による回帰)がある。
関連項目
補足
Microsoft Excel では、X-Y散布図のデータ点に当てはまるような多項式曲線を引くことができる[ 10] 。
脚注
^ Shaw, P (2006). “Intellectual ability and cortical development in children and adolescents”. Nature 440 (7084): 676–679. doi :10.1038/nature04513 . PMID 16572172 .
^ Barker, PA; Street-Perrott, FA; Leng, MJ; Greenwood, PB; Swain, DL; Perrott, RA; Telford, RJ; Ficken, KJ (2001). “A 14,000-Year Oxygen Isotope Record from Diatom Silica in Two Alpine Lakes on Mt. Kenya”. Science 292 (5525): 2307–2310. doi :10.1126/science.1059612 . PMID 11423656 .
^ Greenland, Sander (1995). “Dose-Response and Trend Analysis in Epidemiology: Alternatives to Categorical Analysis”. Epidemiology (Lippincott Williams & Wilkins) 6 (4): 356–365. doi :10.1097/00001648-199507000-00005 . JSTOR 3702080 . PMID 7548341 .
^ Yin-Wen Chang; Cho-Jui Hsieh; Kai-Wei Chang; Michael Ringgaard; Chih-Jen Lin (2010). “Training and testing low-degree polynomial data mappings via linear SVM” . Journal of Machine Learning Research 11 : 1471–1490. http://jmlr.csail.mit.edu/papers/v11/chang10a.html .
^ Gergonne, J. D. (November 1974). “The application of the method of least squares to the interpolation of sequences” . Historia Mathematica 1 (4): 439–447. doi :10.1016/0315-0860(74)90034-2 . http://www.sciencedirect.com/science/article/B6WG9-4D7JMHH-20/2/df451ec5fbb7c044d0f4d900af80ec86 .
^ Stigler, Stephen M. (November 1974). “Gergonne's 1815 paper on the design and analysis of polynomial regression experiments” . Historia Mathematica 1 (4): 431–439. doi :10.1016/0315-0860(74)90033-0 . http://www.sciencedirect.com/science/article/B6WG9-4D7JMHH-1Y/2/680c7ada0198761e9866197d53512ab4 .
^ Smith, Kirstine (1918). “On the Standard Deviations of Adjusted and Interpolated Values of an Observed Polynomial Function and its Constants and the Guidance They Give Towards a Proper Choice of the Distribution of the Observations”. Biometrika 12 (1/2): 1–85. doi :10.2307/2331929 . JSTOR 2331929 .
^
Such "non-local" behavior is a property of analytic functions that are not constant (everywhere). Such "non-local" behavior has been widely discussed in statistics:
Magee, Lonnie (1998). “Nonlocal Behavior in Polynomial Regressions”. The American Statistician (American Statistical Association) 52 (1): 20–22. doi :10.2307/2685560 . JSTOR 2685560 .
^ Fan, Jianqing (1996). Local Polynomial Modelling and Its Applications: From linear regression to nonlinear regression . Monographs on Statistics and Applied Probability. Chapman & Hall/CRC.. ISBN 0-412-98321-4 .
^ “Tutorial: Polynomial Regression in Excel ”. facultystaff.richmond.edu . 2017年1月22日閲覧。
外部リンク