Struct kolmogorov_smirnov::ecdf::Ecdf
[−]
[src]
pub struct Ecdf<T: Ord> { // some fields omitted }
Methods
impl<T: Ord + Clone> Ecdf<T>
[src]
fn new(samples: &[T]) -> Ecdf<T>
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);
fn value(&self, t: T) -> f64
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); println!("{}", ecdf.value(4));