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
//! Diagnostics for **regularized** linear regression — the family the OLS
//! diagnostics deliberately excluded, now provided as first-class types.
//!
//! Regularization changes the fit in ways the OLS formulas can't be reused for.
//! Under ridge the hat matrix becomes `H_λ = X(XᵀX + λI)⁻¹Xᵀ`, so leverage,
//! degrees of freedom, and everything built on them differ; lasso has no
//! closed-form hat matrix at all. Each estimator therefore gets its own fitted
//! type with the diagnostics that are actually well-defined for it:
//!
//! * [`RidgeFit`] — closed-form ridge (via SVD), with **effective degrees of
//!   freedom** `Σ dⱼ²/(dⱼ²+λ)`, ridge leverage, GCV, effective AIC/BIC, and a
//!   [`ridge_vif`](RidgeFit::ridge_vif) that generalizes the OLS VIF and reduces
//!   to it at `λ = 0` — the "VIF before/after regularization" comparison.
//! * [`LassoFit`] — coordinate-descent lasso, whose natural degrees-of-freedom
//!   estimate is simply the size of the **active set** (Zou–Hastie–Tibshirani).
//! * [`ElasticNetFit`] — the lasso/ridge blend
//!   `λ[α‖β‖₁ + ½(1−α)‖β‖²]`, with a **shrinkage-aware** effective df (the
//!   active-set trace under the ridge part) that interpolates between the two.
//! * [`PenalizedLogisticFit`] — a **penalized GLM**: ridge-penalized logistic
//!   regression by penalized IRLS, with effective df `tr[(XᵀWX+λP)⁻¹XᵀWX]`,
//!   sandwich standard errors, and shrinkage-aware AIC/BIC.
//!
//! ## Penalty conventions (read before comparing `λ` across estimators)
//!
//! * **Ridge** penalizes the centered predictors on their given scale; the
//!   intercept (a detected constant column) is never penalized. Ridge is *not*
//!   scale-invariant, so standardizing predictors first is the usual practice.
//! * **Lasso** and **elastic net** standardize predictors internally and
//!   minimize the `(1/2n)`-scaled objective, so their `λ` is on a different
//!   scale than ridge's. Elastic net's `α = 1` reproduces the lasso exactly.
//! * **Penalized logistic** penalizes the coefficients on their given scale
//!   (like ridge OLS), leaving a detected intercept unpenalized.
//!
//! Neither is a drop-in for the other's `λ`; they are documented per-type.

mod elastic_net;
mod lasso;
mod penalized_glm;
mod ridge;

pub use elastic_net::ElasticNetFit;
pub use lasso::LassoFit;
pub use penalized_glm::PenalizedLogisticFit;
pub use ridge::{select_lambda_gcv, RidgeFit};