normality
A Rust crate for assessing the normality of a data sample. It provides several common statistical tests to determine if a set of data is likely drawn from a normal distribution.
All test implementations are generic and can work with f32 or f64 data types. The implementations are ported from well-established algorithms found in popular R packages.
Implemented Tests
Univariate Normality
- Shapiro-Wilk Test
- Lilliefors (Kolmogorov-Smirnov) Test
- Anderson-Darling Test
- Jarque-Bera Test
- Pearson Chi-squared Test
- D'Agostino's K-squared Test
- Anscombe-Glynn Kurtosis Test
- Energy Test
Multivariate Normality
Installation
Either run cargo add normality or add the crate to your Cargo.toml:
[]
= "2"
# To enable parallel execution for faster performance on large data:
# normality = { version = "2", features = ["parallel"] }
Example Usage
Univariate
use ;
Multivariate
Using vec!
use matrix;
use ;
use Error;
Using nalgebra::matrix!
use matrix;
use ;
use Error;
Parallelism
This crate supports optional parallelism via the rayon crate. This can significantly improve performance for large datasets by parallelizing sorting and statistical calculations.
To enable parallelism, add the parallel feature to your Cargo.toml:
[]
= { = "2", = ["parallel"] }
When enabled, functions will automatically use parallel iterators and parallel sorting algorithms. No changes to your code are required.
Accuracy
The accuracy of the implemented tests has been verified against their R equivalents. Running the integration tests for this crate requires a local installation of R and for the Rscript executable to be available in the system's PATH.
License
This project is licensed under the MIT License.