真实模型
Y Y Y is a r.v., X = [ 1 X 1 … X p − 1 ] T X=\begin{bmatrix}1 & X_{1} & \dots & X_{p-1}\end{bmatrix}^T X = [ 1 X 1 … X p − 1 ] T is a random vector. We have
argmin m E [ ( Y − m ( X ) ) 2 ] = E [ Y ∣ X ] \operatorname*{argmin}_{m}\mathbb{E}[(Y-m(X))^{2}]=\mathbb{E}[Y\mid X]
m argmin E [( Y − m ( X ) ) 2 ] = E [ Y ∣ X ]
(The proof is not hard. I'd say it's high school level.)
The best linear fit is β T X \beta^TX β T X where
β = argmin β 0 , β E [ ( Y − β T X ) 2 ] \beta=\operatorname*{argmin}_{\beta_{0},\beta}\mathbb{E}[(Y-\beta^TX)^{2}]
β = β 0 , β argmin E [( Y − β T X ) 2 ]
The solution is
β = ( E [ X X T ] ) − 1 E [ X Y ] \beta=\big(\mathbb E[XX^T]\big)^{-1}\mathbb E[XY]
β = ( E [ X X T ] ) − 1 E [ X Y ]
Now we have some samples of ( Y , X ) (Y,X) ( Y , X ) :
[ y 1 1 x 11 … x 1 p y 2 1 x 21 … x 2 p ⋮ ⋮ ⋮ ⋱ ⋮ y n 1 x n 1 … x n p ] \begin{bmatrix}
y_{1} & 1 & x_{11} & \dots & x_{1p} \\
y_{2} & 1 & x_{21} & \dots & x_{2p} \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
y_{n} & 1 & x_{n1} & \dots & x_{np}
\end{bmatrix}
y 1 y 2 ⋮ y n 1 1 ⋮ 1 x 11 x 21 ⋮ x n 1 … … ⋱ … x 1 p x 2 p ⋮ x n p
And run OLS on the samples, which is to solve
argmin b 0 , … , b p ∑ i = 1 n ( y i − ( b 0 + ∑ k = 1 p b k x i k ) ) 2 \operatorname*{argmin}_{b_{0},\dots,b_{p}} \sum_{i=1}^{n} \left( y_{i}-\left( b_{0}+\sum_{k=1}^{p} b_{k}x_{ik} \right) \right)^{2}
b 0 , … , b p argmin i = 1 ∑ n ( y i − ( b 0 + k = 1 ∑ p b k x ik ) ) 2
This is equal to solve
argmin b 0 , … , b p 1 n ∑ i = 1 n ( y i − ( b 0 + ∑ k = 1 p b k x i k ) ) 2 \operatorname*{argmin}_{b_{0},\dots,b_{p}} {\color{red}\frac{1}{n}} \sum_{i=1}^{n} \left( y_{i}-\left( b_{0}+\sum_{k=1}^{p} b_{k}x_{ik} \right) \right)^{2}
b 0 , … , b p argmin n 1 i = 1 ∑ n ( y i − ( b 0 + k = 1 ∑ p b k x ik ) ) 2
Take limit n → ∞ n\to \infty n → ∞ ,
argmin b 0 , … , b p E [ ( Y − ( b 0 + ∑ k = 1 p b k X k ) ) 2 ] \operatorname*{argmin}_{b_{0},\dots,b_{p}}\mathbb{E}\left[ \left( Y-\left( b_{0}+\sum_{k=1}^{p} b_{k}X_{k} \right) \right)^{2} \right]
b 0 , … , b p argmin E ( Y − ( b 0 + k = 1 ∑ p b k X k ) ) 2
We unrigorously passed the lim \lim lim inside the argmin \operatorname*{argmin} argmin and took the probability limit. The step equating the probability limit to the expectation requires the sampling to satisfy certain conditions, such as weak correlation.
So OLS always estimates β 0 , β \beta_{0},\beta β 0 , β and it's valid because the estimator is consistent.
数据收集
设计矩阵