Struct kolmogorov_smirnov::ecdf::Ecdf [] [src]

pub struct Ecdf<T: Ord> { /* fields omitted */ }

Methods

impl<T: Ord + Clone> Ecdf<T>
[src]

Construct a new representation of a cumulative distribution function for a given sample.

The construction will involve computing a sorted clone of the given sample and may be inefficient or completely prohibitive for large samples. This computation is amortized significantly if there is heavy use of the value function.

Panics

The sample set must be non-empty.

Examples

extern crate kolmogorov_smirnov as ks;

let samples = vec!(9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
let ecdf = ks::Ecdf::new(&samples);

Calculate a value of the empirical cumulative distribution function for a given sample.

Examples

extern crate kolmogorov_smirnov as ks;

let samples = vec!(9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
let ecdf = ks::Ecdf::new(&samples);
assert_eq!(ecdf.value(4), 0.5);

Calculate a percentile for the sample using the Nearest Rank method.

Panics

The percentile requested must be between 1 and 100 inclusive. In particular, there is no 0-percentile.

Examples

extern crate kolmogorov_smirnov as ks;

let samples = vec!(9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
let ecdf = ks::Ecdf::new(&samples);
assert_eq!(ecdf.percentile(50), 4);

Return the minimal element of the samples.

Examples

extern crate kolmogorov_smirnov as ks;

let samples = vec!(9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
let ecdf = ks::Ecdf::new(&samples);
assert_eq!(ecdf.min(), 0);

Return the maximal element of the samples.

Examples

extern crate kolmogorov_smirnov as ks;

let samples = vec!(9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
let ecdf = ks::Ecdf::new(&samples);
assert_eq!(ecdf.max(), 9);