pub fn quartiles(data: &[f64]) -> Result<Quartiles, StatsError>Expand description
Compute Quartiles for data using the type-7 (linear-interpolation)
quartile definition and the standard 1.5 * IQR Tukey rule for whiskers and
outliers.
Non-finite values (NaN, ±inf) are ignored. Returns
StatsError::EmptyInput if no finite values remain.
§Edge cases
- A single point yields
q1 == median == q3, zero IQR, coincident whiskers, and no outliers. - All-identical values yield zero IQR; with zero IQR the fences collapse onto the value, so nothing is flagged as an outlier.
let q = quartiles(&[1.0, 2.0, 3.0, 4.0, 5.0]).unwrap();
assert_eq!(q.median, 3.0);
assert_eq!(q.q1, 2.0);
assert_eq!(q.q3, 4.0);