Skip to main content

leverage

Function leverage 

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

Logistic 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 wᵢ = pᵢ(1 − pᵢ).

The GLM analogue of OLS leverage: it measures how much observation i’s own fitted value is determined by its predictors, but weighted by the binomial variance, so points where the model is already near-certain (pᵢ ≈ 0 or 1) carry little leverage. Computed from the stored covariance without forming the n × n hat matrix, and the values sum to p.