0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

線形回帰の標準誤差の自由度がn-p-1になることの確認

Last updated at Posted at 2019-11-08

###真のモデル

 y = X\beta + \boldsymbol{\varepsilon} \\
y \in \mathbb{R}^n , X \in \mathbb{R}^{n\times (p+1)}, \beta \in \mathbb{R}^{(p+1)} \\
\boldsymbol{\varepsilon} \sim N(\boldsymbol{0},diag(\sigma,\cdots , \sigma ))

説明変数p個に加えて定数項p+1

###線形回帰による推計

 y = X(X^{'}X)^{-1}X^{'}y + \boldsymbol{\epsilon}

推計誤差(残差) $\boldsymbol{\epsilon}$ の2乗平均が真の誤差$\boldsymbol{\varepsilon}$の分散の一致推定量になっていれば話がシンプルだが、以下のようにバイアスが存在する。

###残差2乗和

\begin{aligned}
S^2 & = \boldsymbol{\epsilon}^{'} \boldsymbol{\epsilon} \\
& = (y - X(X^{'}X)^{-1}X^{'}y )^{'}(y - X(X^{'}X)^{-1}X^{'}y ) \\
& = y^{'} y - 2 y^{'} X(X^{'}X)^{-1}X^{'}y + y^{'} X(X^{'}X)^{-1}X^{'}X(X^{'}X)^{-1}X^{'}y  \\
& = y^{'} y -  y^{'} X(X^{'}X)^{-1}X^{'}y  

\end{aligned}

ここで$y = X\beta + \boldsymbol{\varepsilon}$を上式に代入して残差2乗和を真の誤差で表現し、
その期待値について考える。

\begin{aligned}
E[S^2] & = E[\boldsymbol{\varepsilon}^{'} \boldsymbol{\varepsilon} -  \boldsymbol{\varepsilon}^{'} X(X^{'}X)^{-1}X^{'}\boldsymbol{\varepsilon}] \\
& = n \sigma^2 -  E[\boldsymbol{\varepsilon}^{'} X(X^{'}X)^{-1}X^{'}\boldsymbol{\varepsilon}]\\
& = n \sigma^2 -  \sigma^2 \mathrm{Tr}[X(X^{'}X)^{-1}X^{'}] \\
& = n \sigma^2 -  \sigma^2 \mathrm{Tr}[(X^{'}X)^{-1}X^{'}X] ここ怪しい、要再検討\\
& = n \sigma^2 -  \sigma^2 \mathrm{Tr}[\boldsymbol{E}] \\
& = (n -p-1)\sigma^2 
\end{aligned}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?