use Array1;
use crateinternally_studentized_residuals;
use crateOlsFit;
/// Cook's distance `Dᵢ` for each observation.
///
/// `Dᵢ = (rᵢ² / p) · (hᵢ / (1 − hᵢ))`
///
/// where `rᵢ` is the internally studentized residual and `hᵢ` the leverage —
/// reusing the scaled residuals from [`crate::residuals`] rather than
/// recomputing. Cook's distance rolls **residual size and leverage** into a
/// single per-observation influence measure: it is large only when an
/// observation is both poorly fit *and* has unusual predictor values.
///
/// A commonly cited flag is `Dᵢ > 4/n` (convention, not a hard rule).
///
/// Cook's distance and [`dffits`](super::dffits) usually agree on which points
/// are influential; they can diverge because DFFITS uses the *externally*
/// studentized residual (excluding the point from its own scale), making it
/// somewhat more sensitive to a single extreme outlier.