Function kolmogorov_smirnov::test::test [] [src]

pub fn test<T: Ord + Clone>(xs: &[T], ys: &[T], confidence: f64) -> TestResult

Perform a two sample Kolmogorov-Smirnov test on given samples.

The samples must have length > 7 elements for the test to be valid.

Panics

There are assertion panics if either sequence has <= 7 elements.

Examples

extern crate kolmogorov_smirnov as ks;

let xs = vec!(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
let ys = vec!(12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
let confidence = 0.95;

let result = ks::test(&xs, &ys, confidence);

if result.is_rejected {
    println!("{:?} and {:?} are not from the same distribution with probability {}.",
      xs, ys, result.reject_probability);
}