Median_absolute_deviation

Median absolute deviation aggregation

/ Median_absolute_deviation, / Aggregation

Median absolute deviation aggregation #

A single-value metrics aggregation that computes the median absolute deviation — the median of the distances from each value to the median of all values. A robust measure of spread: unlike standard deviation it is not skewed by a few extreme values.

How it works #

The aggregation runs in three steps over the collected values of the field:

  1. Compute the median with the same TDigest arithmetic percentiles uses — weight-1 centroids at (i + 0.5) / n, linear interpolation between the two bracketing values.
  2. Take each value’s absolute distance to that median, |v − median|.
  3. Return the median of those distances, using the same arithmetic again.

Because both medians interpolate, the result can land between observed values (over the 120 teaching sale prices: median 22.5, MAD 7.5 — neither is a price anyone paid). The value is expressed in the same units as the field, so a MAD of 7.5 on prices means “a typical sale is $7.50 away from the median price”.

...