Prove a relação entre a distância e a alavancagem de Mahalanobis?


12

Eu já vi fórmulas na Wikipedia. que relacionam a distância e a alavancagem de Mahalanobis:

A distância de Mahalanobis está intimamente relacionada à estatística de alavancagem, h , mas tem uma escala diferente:

D2=(N−1)(h−1N).

Em um artigo vinculado , a Wikipedia descreve h nestes termos:

No modelo de regressão linear, a pontuação de alavancagem para a ith unidade de dados é definida como:

hii=(H)ii,
o ith elemento diagonal da matriz do chapéu H=X(X⊤X)−1X⊤ , onde ⊤ denota a transposição da matriz.⊤

Não consigo encontrar uma prova em lugar nenhum. Tentei começar pelas definições, mas não posso fazer nenhum progresso. Alguém pode dar alguma dica?

Respostas:


11

Minha descrição da distância de Mahalanobis na parte inferior à parte superior da explicação da distância de Mahalanobis? inclui dois resultados principais:

  1. Por definição, não muda quando os regressores são deslocados uniformemente.

  2. O quadrado de Mahalanobis distância entre vectores de x e y é dada por

    D2(x,y)=(x−y)′Σ−1(x−y)
    onde Σ é a covariância dos dados.

(1) nos permite assumir que as médias dos regressores são todas nulas. Resta calcular hi . No entanto, para que a afirmação seja verdadeira, precisamos adicionar mais uma suposição:

O modelo deve incluir uma interceptação.

Permitindo a este, que haja k≥0 regressores e n de dados, escrevendo o valor do regressor j para observação i como xij . Seja escrito o vetor da coluna desses n valores para o regressor jx,j e o vetor de linha desses k valores para a observação i seja xi . Então a matriz do modelo é

X=(1x11⋯x1k1x21⋯x2k⋮⋮⋮⋮1xn1⋯xnk)

e, por definição, a matriz hat é

H=X(X′X)−1X′,

de onde a entrada i na diagonal é

(1)hi=hii=(1;xi)(X′X)−1(1;xi)′.

Não há nada a não ser descobrir a matriz central inversa - mas em virtude do primeiro resultado-chave, é fácil, especialmente quando a escrevemos na forma de matriz de bloco:

X′X=n(10′0C)

onde 0=(0,0,…,0)′ e

Cjk=1n∑i=1nxijxik=n−1nCov⁡(xj,xk)=n−1nΣjk.

(Eu escrevi Σ para a matriz de covariância de amostra dos regressores.) Como essa é a diagonal do bloco, seu inverso pode ser encontrado simplesmente invertendo os blocos:

(X′X)−1=1n(10′0C−1)=(1n0′01n−1Σ−1).

Da definição (1) we obtain

hi=(1;xi)(1n0′01n−1Σ−1)(1;xi)′=1n+1n−1xiΣ−1xi′=1n+1n−1D2(xi,0).

Solving for the squared Mahalanobis length Di2=D2(xi,0) yields

Di2=(n−1)(hi−1n),

QED.

Looking back, we may trace the additive term 1/n to the presence of an intercept, which introduced the column of ones into the model matrix X. The multiplicative term n−1 appeared after assuming the Mahalanobis distance would be computed using the sample covariance estimate (which divides the sums of squares and products by n−1) rather than the covariance matrix of the data (which divides the sum of squares and products by n).


The chief value of this analysis is to impart a geometric interpretation to the leverage, which measures how much a unit change in the response at observation i will change the fitted value at that observation: high-leverage observations are at large Mahalanobis distances from the centroid of the regressors, exactly as a mechanically efficient lever operates at a large distance from its fulcrum.


R code to show that the relation indeed holds:

x <- mtcars

# Compute Mahalanobis distances
h <- hat(x, intercept = TRUE); names(h) <- rownames(mtcars)
M <- mahalanobis(x, colMeans(x), cov(x))

# Compute D^2 of the question
n <- nrow(x); D2 <- (n-1)*(h - 1/n)

# Compare.
all.equal(M, D2)               # TRUE
print(signif(cbind(M, D2), 3))

Excellent answer, very well rounded with rigor and intuition. Cheers!
— cgrudz

Thanks for the post @whuber ! For sanity check, here is R code to show that the relation indeed holds: x <- mtcars rownames(x) <- NULL colnames(x) <- NULL n <- nrow(x) h <- hat(x, T) mahalanobis(x, colMeans(x), cov(x)) (n-1)*(h - 1/n) all.equal(mahalanobis(x, colMeans(x), cov(x)), (n-1)*(h - 1/n))
— Tal Galili

1
@Tal I didn't think I needed a sanity check--but thank you for the code. :-) I have made modifications to clarify it and its output a little.
— whuber

1
@whuber, I wanted an example that shows how to make the equality works (making clear to me that I got the assumptions right). I've also extended the relevant Wiki entry: en.wikipedia.org/wiki/… (feel free to also expend on it there, as you see fit :) )
— Tal Galili
Ao utilizar nosso site, você reconhece que leu e compreendeu nossa Política de Cookies e nossa Política de Privacidade.
Licensed under cc by-sa 3.0 with attribution required.