pub fn leverage<F: Family>(fit: &GlmFit<F>) -> Array1<f64>Expand description
GLM leverage — the diagonal of the weighted hat matrix
H = W^{1/2}X(XᵀWX)⁻¹XᵀW^{1/2}, i.e. hᵢ = wᵢ · xᵢᵀ(XᵀWX)⁻¹xᵢ with the IRLS
working weight wᵢ = (dμ/dη)² / V(μᵢ).
The GLM analogue of OLS leverage: how much observation i’s own fitted value
is determined by its predictors, weighted by the family variance. The
dispersion cancels (it scales W and (XᵀWX)⁻¹ inversely), so leverage is a
pure geometric quantity; the values sum to p. Computed from the stored
inverse information without forming the n × n hat matrix.