# Explanation of a step in derivation of residuals for R lm diagnostic?

I'm reading Faraway's book (http://cran.r-project.org/doc/contrib/Faraway-PRA.pdf) to try to understand R's lm diagnostic plots. On page 72 of the book is this:

I have been trying to understand a few things about this for a few days reading online and some help would be very, very appreciated.

1. In the derivation of $var(\hat\varepsilon)$, why did the term $(1-H)X\beta$ vanish? Where did it go?
2. What is an intuitive explanation of what $h_i$ means in terms of my data? What does each $h_i$ in the $H$ vector (not matrix?) correspond to? How is $h_i = H_ii$?
3. What is $p$?

## 1 Answer

1. Try the obvious - expanding it out:

$$(I - H) X = X - HX = X - X(X'X)^{-1}X' X = X - X = \mathbf{0}$$

Oh, and $\mathbf{0}\beta = \underline{0}$.

2. Each element $h_i$ has several interpretations.

e.g. (i) It's the rate of change of $\hat{y}$ with respect to $y$.

e.g. (ii) It's the proportion by which the variance of a residual is reduced from the corresponding variance of the error it approximates - as was showed in the text in the image.

The reason $h_i = H_{ii}$ is because we defined it that way.

3. $p$ is the number of predictors (including the intercept in this case), the column dimension of $X$.