greeners 1.0.0

High-performance econometrics with R/Python formulas. Two-Way Clustering, Marginal Effects (AME/MEM), HC1-4, IV Predictions, Categorical C(var), Polynomial I(x^2), Interactions, Diagnostics. OLS, IV/2SLS, DiD, Logit/Probit, Panel (FE/RE), Time Series (VAR/VECM), Quantile!
Documentation
use thiserror::Error;

/// Custom error types for the Greeners library.
#[derive(Error, Debug)]
pub enum GreenersError {
    /// Error thrown when input dimensions (shapes) do not match expectation.
    #[error("Dimension mismatch: {0}")]
    ShapeMismatch(String),

    /// Error thrown during matrix inversion if the matrix is singular (determinant is zero).
    #[error("Singular matrix encountered. The matrix cannot be inverted.")]
    SingularMatrix,

    /// Error thrown when statistical distributions cannot be initialized
    /// (e.g., degrees of freedom <= 0).
    #[error("Statistical distribution error (optimization/initialization failed)")]
    OptimizationFailed,

    /// Wrapper for errors coming from the ndarray-linalg backend.
    #[error("Linear Algebra backend error: {0}")]
    LinalgError(#[from] ndarray_linalg::error::LinalgError),

    /// Error thrown when parsing a formula string
    #[error("Formula parsing error: {0}")]
    FormulaError(String),

    /// Error thrown when a variable is not found in the data
    #[error("Variable not found in data: {0}")]
    VariableNotFound(String),
}