pub fn quantile(sorted: &[f64], q: f64) -> Option<f64>Expand description
The q quantile of sorted values, linear between the two nearest ranks (Hyndman and
Fan’s type 7, the default of R and NumPy). None for no values.
use majordomus_cli::economics::stats::quantile;
assert_eq!(quantile(&[1.0, 2.0, 3.0, 4.0], 0.5), Some(2.5));
assert_eq!(quantile(&[7.0], 0.95), Some(7.0));
assert_eq!(quantile(&[], 0.5), None);