Hat matrix (projection matrix)
The matrix H = X(XᵀX)⁻¹Xᵀ that turns the observed values into the predicted ones: ŷ = Hy (“y hat”). Its diagonal elements are the leverage values. Its trace is the number of coefficients p.
Example: With n = 50 and p = 3 the mean leverage is 3/50 = 0.06. A value above 2p/n = 0.12 is often seen as conspicuous.
Caution: The limit 2p/n is a habit. Leverage shows only the position in the predictors, not the influence on the outcome.