4 releases

0.2.2 Feb 24, 2021
0.2.1 Feb 16, 2021
0.2.0 Nov 30, 2020
0.1.0 Nov 14, 2020

#1854 in Algorithms

Download history 72/week @ 2024-03-24 125/week @ 2024-03-31 176/week @ 2024-04-07 79/week @ 2024-04-14 308/week @ 2024-04-21 159/week @ 2024-04-28 99/week @ 2024-05-05 33/week @ 2024-05-12 48/week @ 2024-05-19 195/week @ 2024-05-26 79/week @ 2024-06-02 222/week @ 2024-06-09 489/week @ 2024-06-16 308/week @ 2024-06-23 516/week @ 2024-06-30 302/week @ 2024-07-07

1,637 downloads per month
Used in kaspa-addressmanager

MIT license

17KB
349 lines

statest

Rust crate for statistical tests.

docs.rs

Now

  • T test
  • Kolmogorov–Smirnov test
  • Chi2 test

is available.

usage

T test

use statest::ttest::*;

fn main() {
    let v: Vec<f32> = vec![100.2, 101.5, 98.0, 100.1, 100.9, 99.6, 98.6, 102.1, 101.4, 97.9];
    println!("{}", v.ttest1(102.0, 0.05, Side::One(UPLO::Upper))); // true
}

Kolmogorov–Smirnov test

use rand_distr::{StudentT, Distribution};
use statest::ks::*;
use statrs::distribution::{StudentsT, Exponential, Normal};

fn main() {
    let t = StudentT::new(1.0).unwrap();
    let t_vec = (0..1000).map(|_| t.sample(&mut rand::thread_rng()))
                         .collect::<Vec<f64>>();
    let tdist = StudentsT::new(0.0, 1.0, 1.0).unwrap();
    let ndist = Normal::new(0.0, 1.0).unwrap();
    let edist = Exponential::new(1.0).unwrap();
    println!("StudentT? {}", t_vec.ks1(&tdist, 0.05)); // true
    println!("Normal? {}", t_vec.ks1(&ndist, 0.05)); // false
    println!("Exponential? {}", t_vec.ks1(&edist, 0.05)); // false
}

Dependencies

~5.5MB
~105K SLoC