Boxplot

Boxplot aggregation

/ Boxplot, / Aggregation

Boxplot aggregation #

A multi-value metrics aggregation producing the five-number summary of a distribution: minimum, lower quartile (q1), median (q2), upper quartile (q3) and maximum, plus whiskers.

How it works #

The engine collects and sorts the values of the field, then:

  • min / max are the observed extremes (after missing substitution).
  • q1, q2, q3 are the 25th, 50th and 75th percentiles, computed with the same TDigest arithmetic percentiles uses — weight-1 centroids at (i + 0.5) / n with linear interpolation between the two bracketing values. A quartile can therefore land between observed values (q2 of the sale prices is 22.5, between 15 and 30).
  • The whiskers extend from the quartiles by 1.5 × IQR, where IQR = q3 − q1, and are clamped to the data: lower = max(q1 − 1.5·IQR, min), upper = min(q3 + 1.5·IQR, max). Values beyond the unclamped whisker positions are the conventional boxplot outliers.

Clamping means on a compact distribution the whiskers simply touch the extremes — over the teaching sales prices the whiskers land exactly on min and max. If no document has a value for the field, all seven numbers are 0.

...