Function kolmogorov_smirnov::ecdf::percentile
[−]
[src]
pub fn percentile<T: Ord + Clone>(samples: &[T], p: u8) -> T
Calculate a one-time percentile for a given sample using the Nearest Rank method and Quick Select.
Computational running time of this function is O(n) but does not amortize
across multiple calls like Ecdf
Panics
The sample set must be non-empty.
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 percentile = ks::percentile(&samples, 50); assert_eq!(percentile, 4);