This question is motivated from here :Why leverage measure the distance of the ith observation from the center of the x space?

which is the question related to the wonderful answer of this link :Prove the relation between Mahalanobis distance and Leverage?

It is known that the diagonal elements of hat matrix can be used to measure the distance between the center of data and one specific data point.

It seems clear that the diagonal elements of hat matrix is related to Mahalanobis distance when the data is centered (or the mean of the regressor vectors is 0).

But many text books refer hat matrix's diagonal elements when the data is not centered as standardized measure of the distance from the centeroid.

How does it come possible?


1 Answer 1


The fact hat matrix of the uncentered data and one of the centered data has the linear relationship makes it possible.

Let's say the linear model $Y=X\beta+\epsilon$. This model has the hat matrix $H=X(X'X)^{-1}X$ as known.

And let's consider the centered linear model $Y_c=X_c \beta_c+\epsilon$ where $Y_c=Y-\frac{1}{n} 1_n 1_n' Y$ is the centered response vector and the $X_c=X_d-\frac{1}{n} 1_n 1_n' X_d$ is the centered design matrix ($X_d$ is the design matrix $X$ without column of ones.) and it has no column of ones for intercept because this model passes the origin. This has the hat matrix $H_c=X_c(X_c'X_c)^{-1}X_c'$.

$X = \begin{bmatrix}1_n & X_d\end{bmatrix}$

$X'X = \begin{bmatrix}1_n'1_n & 1_n'X_d \\ X_d'1_n&X_d'X_d\end{bmatrix}$

$(X'X)^{-1}=\begin{bmatrix} 1/n+1/n^2 1_n'X_d(X_c'X_c)^{-1} X_d' 1_n & -1/n 1_n'X_d (X_c'X_c)^{-1} \\ -1/n (X_c'X_c)^{-1} X_d' 1_n &(X_c'X_c)^{-1} \end{bmatrix}$

$\begin{align} X(X'X)^{-1}X'&= 1/n 1_n 1_n' + 1/n^2 1_n 1_n' X_d(X_c'X_c)^{-1} X_d' 1_n1_n'-1/n X_d (X_c'X_c)^{-1} X_d' 1_n 1_n'-1/n 1_n 1_n'X_d (X_c'X_c)^{-1} X_d'+ X_d(X_c'X_c)^{-1}X_d'\\ &=1/n 1_n1_n' + (1/n 1_n1_n' -I)X_d (X_c'X_c)^{-1} X_d' (1/n 1_n1_n' -I) \\ &=1/n 1_n1_n'+X_c(X_c'X_c)^{-1}X_c' \end{align}$

So $H=H_c+1/n 1_n1_n'$.

The result from the answer of second link in the question can be written as $D_i^2 = (n-1)\left(h_i - \frac{1}{n}\right)=(n-1) h_{c i}$

Therefore we can use hat matrix for the measure of the distance as well.

I am not a native English speaker so any improvement of this answer is very welcomed.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.