pub fn quartiles<T>(data: &[T]) -> Option<(T, T, T)>Expand description
Computes the 1st, 2nd, and 3rd quartiles of a numeric data series.
This function uses linear interpolation to estimate the 25th, 50th, and 75th
percentiles based on the formula position = p * (n - 1). Where p is the
current percentile (i.e: 0.25 for 25th, 0.50 for 50th, 0.75 for 75th percentiles).
ยงExample
use quant_mathema::stats::quartiles;
let data = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0];
if let Some((q1, q2, q3)) = quartiles(&data) {
assert_eq!(q2, 3.5); // Median
}