Skip to main content

median_abs_deviation

Function median_abs_deviation 

Source
pub fn median_abs_deviation(values: &[f64], center: f64) -> Option<f64>
Expand description

Median absolute deviation of a slice about a given center.

Computes median(|v − center|) with the same conventions as median (total-order sort, even-n midpoint mean). Note this returns the raw MAD — multiply by MAD_TO_SIGMA to obtain a Gaussian-consistent σ estimate.

§Arguments

  • values — Sample values. Precondition: finite (callers enforce via crate::validation).
  • center — Center to take deviations about (typically the sample median).

§Returns

Some(mad), or None if values is empty.