statsrust - Statistical Analysis Library for Rust
statsrust is a high-performance statistical analysis library for Rust developers, designed with emphasis on numerical stability, mathematical correctness, and user-friendly API.
Features
- Descriptive Statistics: Comprehensive implementation of measures of central tendency, position, and variability
- Kernel Density Estimation: Multiple kernel functions with efficient implementation
- Normal Distribution Model: Complete algebraic operations on normal distributions
- Numerical Stability: Carefully designed algorithms to prevent overflow, underflow, and cancellation errors
- Comprehensive Error Handling: Detailed error messages for edge cases
- Generic Input Support: Works with various numeric types
Installation
Add this to your Cargo.toml
:
[]
= "0.1.0" # Replace with the latest version
Quick Start
use *;
Key Highlights
Numerical Stability
Our algorithms are designed to avoid common numerical issues:
- Geometric mean uses logarithmic transformation to prevent overflow
- Variance calculation uses centered data to avoid catastrophic cancellation
- Inverse CDF approximations maintain precision while balancing performance
Kernel Density Estimation
Efficient implementation with multiple kernel functions:
- Gaussian, Epanechnikov, Triangular, Quartic, Triweight, and more
- Optimized for bounded kernels using binary search
- Supports both PDF and CDF estimation
- Random sample generation from estimated distributions
Normal Distribution Model
Complete algebraic operations:
let dist1 = new?;
let dist2 = new?;
// Distribution operations
let sum_dist = dist1 + dist2; // N(1.0, √5)
let scaled_dist = dist1 * 2.0; // N(0.0, 2.0)
let overlap = dist1.overlap; // Calculate distribution overlap
Documentation
For comprehensive documentation:
Contributing
We welcome contributions! Please see our Contribution Guidelines for details on how to report bugs, suggest enhancements, or submit pull requests.
License
This project is dual-licensed under:
Documentation content is licensed under:
This document is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
Original author: statsrust Authors