regression-diagnostics 0.2.0

Statistical diagnostics for OLS regression in Rust: VIF, condition number, adjusted R2, F/AIC/BIC, residual tests (Durbin-Watson, Breusch-Pagan, White, Jarque-Bera), influence measures (leverage, Cook's distance, DFFITS), QQ-plot data, and an R/statsmodels-style summary().
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use ndarray::Array1;

use crate::OlsFit;

/// Standardized residuals `eᵢ / s`, where `s` is the residual standard error.
///
/// This is the simplest scaling — it divides by a single global estimate and,
/// unlike the studentized forms, does **not** correct for the differing
/// variances of individual residuals (via leverage). For influence work and
/// QQ plots prefer [`super::internally_studentized_residuals`] or
/// [`super::externally_studentized_residuals`].
pub fn standardized_residuals(fit: &OlsFit) -> Array1<f64> {
    let s = fit.residual_standard_error();
    fit.residuals().mapv(|e| e / s)
}