In linear regression, influential diagnosis is important to obtain better model fit and performance. Usually such diagnosis is based on residuals. Here are some important residuals that help locate influentials.
A point is called a influential if it violate the model + could (potentially) influence the estimator . The former is called outlier, the latter is called leverage.
Recap: Linear regression
For linear model (with intercept)
Y = X n × ( p + 1 ) β ( p + 1 ) × 1 + ε , ε ∼ N ( 0 , σ 2 I ) \begin{align}
Y=\mathop{X}\limits_{n\times (p+1)} \mathop{\beta }\limits_{(p+1)\times 1} +\varepsilon ,\quad \varepsilon \sim N(0,\sigma ^2I)
\end{align} Y = n × ( p + 1 ) X ( p + 1 ) × 1 β + ε , ε ∼ N ( 0 , σ 2 I )
the OLS regression result:
Y ^ = X ( X ′ X ) − 1 X ′ Y : = H Y H : = X ( X ′ X ) − 1 X ′ = ∂ Y ^ ∂ Y β ^ = ( X ′ X ) − 1 X ′ Y ∼ N ( β , σ 2 ( X ′ X ) − 1 ) e = Y ^ − Y = ( I − H ) Y ∼ N ( 0 , σ 2 ( I − H ) ) σ ^ 2 = e ′ e n − p − 1 = Y ′ ( I − H ) Y n − p − 1 ( n − p − 1 ) σ ^ 2 σ 2 ∼ χ n − p − 1 2 \begin{align}
\hat{Y}=&X(X'X)^{-1}X'Y:=HY\\
H:=&X(X'X)^{-1}X'=\dfrac{\partial^{} \hat{Y}}{\partial Y^{}}\\
\hat{\beta }=&(X'X)^{-1}X'Y\sim N(\beta ,\sigma ^2(X'X)^{-1})\\
e=&\hat{Y}-Y=(I-H)Y\sim N(0,\sigma ^2(I-H))\\
\hat{\sigma }^2=&\dfrac{e'e}{n-p-1}=\dfrac{Y'(I-H)Y}{n-p-1}\\
&\dfrac{(n-p-1)\hat{\sigma }^2}{\sigma ^2}\sim \chi^2_{n-p-1}
\end{align} Y ^ = H := β ^ = e = σ ^ 2 = X ( X ′ X ) − 1 X ′ Y := H Y X ( X ′ X ) − 1 X ′ = ∂ Y ∂ Y ^ ( X ′ X ) − 1 X ′ Y ∼ N ( β , σ 2 ( X ′ X ) − 1 ) Y ^ − Y = ( I − H ) Y ∼ N ( 0 , σ 2 ( I − H )) n − p − 1 e ′ e = n − p − 1 Y ′ ( I − H ) Y σ 2 ( n − p − 1 ) σ ^ 2 ∼ χ n − p − 1 2
Residuals
Self-sensitivity h i i h_{ii} h ii for Leverage Point
Self-sensitivity h i i h_{ii} h ii is the weight of data point in estimating Y ^ \hat{Y} Y ^ . h i i h_{ii} h ii are the diagonal elements of hat matrix H H H .
h i i : = ∂ Y ^ ∂ Y ∣ i i = X i ′ ( X ′ X ) − 1 X i = H i i \begin{align}
h_{ii}:=\dfrac{\partial^{} \hat{Y}}{\partial Y^{}}\Bigg|_{ii}=X_i'(X'X)^{-1}X_i=H_{ii}
\end{align} h ii := ∂ Y ∂ Y ^ ii = X i ′ ( X ′ X ) − 1 X i = H ii
Comment: In linear regreesion, the design matrix X X X is considered without randomness. Then the change in Y Y Y would results in change of β ^ \hat{\beta } β ^ , and finally result in change of Y ^ \hat{Y} Y ^ . This is a measure of "how a data point is potentially capable of influencing estimation" -- Leverage.
Standardized Residual e s d i e_{\mathrm{sd}i} e sd i for Outlier
Standardized residual is just a normalization to σ 2 = 1 \sigma ^2=1 σ 2 = 1
e s d i = e i σ e i = e i σ 1 − h i i ∼ N ( 0 , 1 ) \begin{align}
e_{\mathrm{sd}i}=\dfrac{e_i}{\sigma _{e_i}}=\dfrac{e_i}{\sigma \sqrt{1-h_{ii}}}\sim N(0,1)
\end{align} e sd i = σ e i e i = σ 1 − h ii e i ∼ N ( 0 , 1 )
Internally Studentized Residual r i r_i r i
(Internally) Studentized residual is obtained by replacing σ \sigma σ into σ ^ \hat{\sigma } σ ^ in standardized residual
r i = e i σ ^ 1 − h i i ∼ t n − p − 1 \begin{align}
r_i=\dfrac{e_i}{\hat{\sigma }\sqrt{1-h_{ii}}}\sim t_{n-p-1}
\end{align} r i = σ ^ 1 − h ii e i ∼ t n − p − 1
Deleted Residual d i d_i d i for Leverage
Recall that self-sensitivity reflected the influence when Y i Y_i Y i changes. Here deleted residual focus on when Y i Y_i Y i disappears. Denote Y ^ i ( ∧ i ) \hat{Y}_{i(\wedge i)} Y ^ i ( ∧ i ) for estimator of Y i Y_i Y i from the model without ( X i , Y i ) (X_i,Y_i) ( X i , Y i ) involved (i.e. Y ^ i ( ∧ i ) \hat{Y}_{i(\wedge i)} Y ^ i ( ∧ i ) is a predictor Y ^ i ( ∧ i ) = X i ′ β ^ ( ∧ i ) \hat{Y}_{i(\wedge i)}=X_i'\hat{\beta }_{(\wedge i)} Y ^ i ( ∧ i ) = X i ′ β ^ ( ∧ i ) ).
d i = Y i − Y ^ i ( ∧ i ) = e i 1 − h i i \begin{align}
d_i=Y_i-\hat{Y}_{i(\wedge i)}\color{red}= \dfrac{e_i}{1-h_{ii}}
\end{align} d i = Y i − Y ^ i ( ∧ i ) = 1 − h ii e i
Here's the proof for = \color{red}= = :
Sherman-Morrison lemma: ( A + B ) − 1 = A − 1 − 1 1 + t r ( B A − 1 ) A − 1 B A − 1 (A+B)^{-1}=A^{-1}-\dfrac{1}{1+tr(BA^{-1})}A^{-1}BA^{-1} ( A + B ) − 1 = A − 1 − 1 + t r ( B A − 1 ) 1 A − 1 B A − 1 , where r a n k ( B ) = 1 \mathrm{rank}(B)=1 rank ( B ) = 1 . Denote B = u v ′ B=uv' B = u v ′ , then:
( A + B ) − 1 ( A + B ) = I + A − 1 B − A − 1 B + A − 1 B A − 1 B 1 + t r ( B A − 1 ) = I + A − 1 B − A − 1 u v ′ + A − 1 u ( v ′ A − 1 u ) v ′ 1 + t r ( B A − 1 = I + A − 1 B − A − 1 u v ′ ( 1 + t r ( u v ′ A − 1 ) ) 1 + t r ( B A − 1 = I \begin{align}
(A+B)^{-1}(A+B)=&I+A^{-1}B-\dfrac{A^{-1}B+A^{-1}BA^{-1}B}{1+tr(BA^{-1})}\\
=&I+A^{-1}B-\dfrac{A^{-1}uv'+A^{-1}u (v'A^{-1}u)v' }{1+tr(BA^{-1}}\\
=&I+A^{-1}B-\dfrac{A^{-1}uv'(1+tr(uv'A^{-1})) }{1+tr(BA^{-1}}\\
=&I
\end{align} ( A + B ) − 1 ( A + B ) = = = = I + A − 1 B − 1 + t r ( B A − 1 ) A − 1 B + A − 1 B A − 1 B I + A − 1 B − 1 + t r ( B A − 1 A − 1 u v ′ + A − 1 u ( v ′ A − 1 u ) v ′ I + A − 1 B − 1 + t r ( B A − 1 A − 1 u v ′ ( 1 + t r ( u v ′ A − 1 )) I
To solve β ^ ( ∧ i ) = ( X ( ∧ i ) ′ X ( ∧ i ) ) − 1 X ( ∧ i ) ′ \hat{\beta }_{(\wedge i)}=\left(X_{(\wedge i)}'X_{(\wedge i)}\right)^{-1}X'_{(\wedge i)} β ^ ( ∧ i ) = ( X ( ∧ i ) ′ X ( ∧ i ) ) − 1 X ( ∧ i ) ′ , here we denote X i X_i X i as a row vector , i.e.X i = ( 1 , X i 1 , X i 2 , … , X i p ) X_i=(1,X_{i1},X_{i2},\ldots,X_{ip}) X i = ( 1 , X i 1 , X i 2 , … , X i p ) . Using the above lemma:
( X ( ∧ i ) ′ X ( ∧ i ) ) − 1 = ( X ′ X − X i ′ X i ) − 1 = ( X ′ X ) − 1 + 1 1 − t r [ X i ′ X i ( X ′ X ) − 1 ] ( X ′ X ) − 1 X i ′ X i ( X ′ X ) − 1 = ( X ′ X ) − 1 + 1 1 − h i i ( X ′ X ) − 1 X i ′ X i ( X ′ X ) − 1 X ( ∧ i ) Y ( ∧ i ) = X ′ Y − X i ′ Y i \begin{align}
(X_{(\wedge i)}'X_{(\wedge i)})^{-1}=&(X'X-X_i'X_i)^{-1}\\
=&(X'X)^{-1}+\dfrac{1}{1-tr[X_i'X_i(X'X)^{-1}]}(X'X)^{-1}X_i'X_i(X'X)^{-1}\\
=&(X'X)^{-1}+\dfrac{1}{1-h_{ii}}(X'X)^{-1}X_i'X_i(X'X)^{-1}\\
X_{(\wedge i)}Y_{(\wedge i)}=&X'Y-X_i'Y_i
\end{align} ( X ( ∧ i ) ′ X ( ∧ i ) ) − 1 = = = X ( ∧ i ) Y ( ∧ i ) = ( X ′ X − X i ′ X i ) − 1 ( X ′ X ) − 1 + 1 − t r [ X i ′ X i ( X ′ X ) − 1 ] 1 ( X ′ X ) − 1 X i ′ X i ( X ′ X ) − 1 ( X ′ X ) − 1 + 1 − h ii 1 ( X ′ X ) − 1 X i ′ X i ( X ′ X ) − 1 X ′ Y − X i ′ Y i
then calaulate β ^ ( ∧ i ) \hat{\beta }_{(\wedge i)} β ^ ( ∧ i ) :
β ^ ( ∧ i ) = ( X ( ∧ i ) ′ X ( ∧ i ) ) − 1 X ( ∧ i ) ′ Y ( ∧ i ) = [ ( X ′ X ) − 1 + ( X ′ X ) − 1 X i ′ X i ( X ′ X ) − 1 1 − h i i ] ( X ′ Y − X i ′ Y i ) = β ^ + ( X ′ X ) − 1 X i ′ X i ( X ′ X ) − 1 X ′ Y 1 − h i i − ( X ′ X ) − 1 X i ′ Y i − ( X ′ X ) − 1 X i ′ X i ( X ′ X ) − 1 X i ′ Y i 1 − h i i = β ^ + ( X ′ X ) − 1 X i ′ Y ^ i 1 − h i i − ( X ′ X ) − 1 X i ′ Y i ( 1 − h i i ) 1 − h i i − ( X ′ X ) − 1 X i ′ Y i 1 − h i i h i i = β ^ + ( X ′ X ) − 1 X i ′ 1 − h i i ( Y ^ i − Y i ) \begin{align}
\hat{\beta }_{(\wedge i)}=&(X_{(\wedge i)}'X_{(\wedge i)})^{-1}X_{(\wedge i)}'Y_{(\wedge i)}\notag \\
=&\left[(X'X)^{-1}+\dfrac{(X'X)^{-1}X_i'X_i(X'X)^{-1}}{1-h_{ii}}\right]\left(X'Y-X_i'Y_i\right)\notag\\
=&\hat{\beta }+\dfrac{(X'X)^{-1}X_i'{X_i(X'X)^{-1}X'Y}}{1-h_{ii}}-(X'X)^{-1}X_i'Y_i-\dfrac{(X'X)^{-1}X_i'{X_i(X'X)^{-1}X_i'}Y_i}{1-h_{ii}}\notag\\
=&\hat{\beta }+\dfrac{(X'X)^{-1}X_i'{\hat{Y}_i}}{1-h_{ii}}-\dfrac{(X'X)^{-1}X_i'Y_i(1-h_{ii})}{1-h_{ii}}-\dfrac{(X'X)^{-1}X_i'Y_i}{1-h_{ii}}{h_{ii}}\notag\\
=&\hat{\beta }+\dfrac{(X'X)^{-1}X_i'}{1-h_{ii}}(\hat{Y}_i-Y_i)
\end{align} β ^ ( ∧ i ) = = = = = ( X ( ∧ i ) ′ X ( ∧ i ) ) − 1 X ( ∧ i ) ′ Y ( ∧ i ) [ ( X ′ X ) − 1 + 1 − h ii ( X ′ X ) − 1 X i ′ X i ( X ′ X ) − 1 ] ( X ′ Y − X i ′ Y i ) β ^ + 1 − h ii ( X ′ X ) − 1 X i ′ X i ( X ′ X ) − 1 X ′ Y − ( X ′ X ) − 1 X i ′ Y i − 1 − h ii ( X ′ X ) − 1 X i ′ X i ( X ′ X ) − 1 X i ′ Y i β ^ + 1 − h ii ( X ′ X ) − 1 X i ′ Y ^ i − 1 − h ii ( X ′ X ) − 1 X i ′ Y i ( 1 − h ii ) − 1 − h ii ( X ′ X ) − 1 X i ′ Y i h ii β ^ + 1 − h ii ( X ′ X ) − 1 X i ′ ( Y ^ i − Y i )
Then
Y i − Y ^ i ( ∧ i ) = Y i − Y ^ i + Y ^ i − Y ^ i ( ∧ i ) = e i + X i ( β ^ − β ^ ( ∧ i ) ) = e i + X i ( X ′ X ) − 1 X i ′ e i 1 − h i i = e i 1 − h i i \begin{align}
Y_i-\hat{Y}_{i(\wedge i)}=&Y_i-\hat{Y}_i+\hat{Y}_i-\hat{Y}_{i(\wedge i)}\\
=&e_i+X_i(\hat{\beta }-\hat{\beta }_{(\wedge i)})\\
=&e_i+X_i(X'X)^{-1}X_i'\dfrac{e_i}{1-h_{ii}}\\
=&\dfrac{e_i}{1-h_{ii}}
\end{align} Y i − Y ^ i ( ∧ i ) = = = = Y i − Y ^ i + Y ^ i − Y ^ i ( ∧ i ) e i + X i ( β ^ − β ^ ( ∧ i ) ) e i + X i ( X ′ X ) − 1 X i ′ 1 − h ii e i 1 − h ii e i
Comment: the result indicates that
d i : = Y i − Y ^ i ( ∧ i ) = e i 1 − h i i ∼ N ( 0 , σ 2 1 − h i i ) \begin{align}
d_i:=Y_i-\hat{Y}_{i(\wedge i)}=\dfrac{e_i}{1-h_{ii}}\sim N(0,\dfrac{\sigma ^2}{1-h_{ii}})
\end{align} d i := Y i − Y ^ i ( ∧ i ) = 1 − h ii e i ∼ N ( 0 , 1 − h ii σ 2 )
where σ 2 = σ ^ ( ∧ i ) 2 \sigma ^2=\hat{\sigma }_{(\wedge i)}^2 σ 2 = σ ^ ( ∧ i ) 2 is estimated by the corresponding M S E \mathrm{MSE} MSE
Externally Studentized Residual
In internally studentized residual, note that σ ^ 2 \hat{\sigma }^2 σ ^ 2 could be significantly influenced if Y i Y_i Y i is an influential. To avoid the self-influence, e i e_i e i is replaced by d i d_i d i , i.e.
t i : = d i s ( d i ) = e i σ ^ ( ∧ i ) 1 − h i i ∼ t n − p − 2 \begin{align}
t_i:=\dfrac{d_i}{s(d_i)}=\dfrac{e_i}{\hat{\sigma }_{(\wedge i)}\sqrt{1-h_{ii}}}\sim t_{n-p-2}
\end{align} t i := s ( d i ) d i = σ ^ ( ∧ i ) 1 − h ii e i ∼ t n − p − 2
where the variance estimator is given by
( n − p − 2 ) σ ^ ( ∧ i ) 2 : = ( n − p − 2 ) σ ^ 2 e ( ∧ i ) ′ e ( ∧ i ) = ( Y ( ∧ i ) − X ( ∧ i ) β ( ∧ i ) ) ′ ( Y ( ∧ i ) − X ( ∧ i ) β ( ∧ i ) ) = ( e ′ e − e i 2 ) + 2 e i 1 − h i i h i i ( Y ^ i − Y i ) + e i 2 1 − h i i h i i = e ′ e − e i 2 1 − h i i = ( n − p − 1 ) σ ^ 2 − e i 2 1 − h i i \begin{align}
(n-p-2)\hat{\sigma }^2_{(\wedge i)}:=&(n-p-2)\hat{\sigma }^2
{e'_{(\wedge i)}e_{(\wedge i)}}{}\\
=&{(Y_{(\wedge i)}-X_{(\wedge i)}\beta _{(\wedge i)})'(Y_{(\wedge i)}-X_{(\wedge i)}\beta _{(\wedge i)})}\\
=&(e'e-e_i^2)+\dfrac{2e_i}{1-h_{ii}}h_{ii}(\hat{Y}_i-Y_i)+\dfrac{e_i^2}{1-h_{ii}}h_{ii} \\
=&e'e-\dfrac{e_i^2}{1-h_{ii}}\\
=&(n-p-1)\hat{\sigma }^2-\dfrac{e_i^2}{1-h_{ii}}
\end{align} ( n − p − 2 ) σ ^ ( ∧ i ) 2 := = = = = ( n − p − 2 ) σ ^ 2 e ( ∧ i ) ′ e ( ∧ i ) ( Y ( ∧ i ) − X ( ∧ i ) β ( ∧ i ) ) ′ ( Y ( ∧ i ) − X ( ∧ i ) β ( ∧ i ) ) ( e ′ e − e i 2 ) + 1 − h ii 2 e i h ii ( Y ^ i − Y i ) + 1 − h ii e i 2 h ii e ′ e − 1 − h ii e i 2 ( n − p − 1 ) σ ^ 2 − 1 − h ii e i 2
thus externally studentized residual t i t_i t i could also be expressed by r i r_i r i as:
t i = e i σ ^ ( ∧ i ) 1 − h i i = e i σ ^ 1 − h i i ( σ ^ σ ^ ( ∧ i ) ) 1 / 2 = r i ( n − p − 2 n − p − 1 − r i 2 ) 1 / 2 < r i \begin{align}
t_i=&\dfrac{e_i}{\hat{\sigma }_{(\wedge i)}\sqrt{1-h_{ii}}}\\
=&\dfrac{e_i}{\hat{\sigma }\sqrt{1-h_{ii}}}\left(\dfrac{\hat{\sigma }}{\hat{\sigma }_{(\wedge i)}}\right)^{1/2}\\
=&r_i\left(\dfrac{n-p-2}{n-p-1-r_i^2}\right)^{1/2}<r_i
\end{align} t i = = = σ ^ ( ∧ i ) 1 − h ii e i σ ^ 1 − h ii e i ( σ ^ ( ∧ i ) σ ^ ) 1/2 r i ( n − p − 1 − r i 2 n − p − 2 ) 1/2 < r i