Skip to main content

leverage

Function leverage 

Source
pub fn leverage(fit: &OlsFit) -> Array1<f64>
Expand description

Leverage hᵢ (the diagonal of the hat matrix) for each observation.

This is already computed efficiently at fit time from the thin Q factor — the full n × n hat matrix is never materialized — and simply surfaced here.

§Interpretation

Leverage measures how unusual an observation’s predictor values are, independent of its response. High leverage is potential influence, not influence itself: a high-leverage point that happens to sit on the fitted line barely moves it. Combine leverage with residual size — that is exactly what cooks_distance and dffits do.

Each hᵢ ∈ [0, 1] and Σ hᵢ = p, so the average leverage is p/n; the common flags are multiples of that average (2p/n, 3p/n).