Array Quantile

Shipping
array_quantile

Quantile / percentile of an array with NumPy-style interpolation methods

Signature

Inputs

  • dataArrayrequiredAny array, flattened to 1-D before the order statistic is taken.

Outputs

  • valueScalarThe requested quantile of the data.

Parameters

KeyTypeDefaultNotes
qfloat0.5Quantile to compute in $[0,1]$; $0.5$ is the median, $0.25$ the lower quartile.
methodenumlinearone of: linear, lower, higher, nearest, midpoint

Description

Array Quantile returns the value at quantile of the flattened input — is the median, the first quartile, the 99th percentile, and so on. When the target rank falls between two samples, the method parameter selects how to combine the bracketing order statistics, following NumPy's percentile conventions:

  • linear — linearly interpolate between the two neighbours (the default).
  • lower / higher — take the lower or higher neighbour.
  • nearest — take the nearest by rank.
  • midpoint — the average of the two neighbours.

The node is stateless and order-statistic based, so it is robust to a handful of extreme outliers in a way the mean is not.

Mathematics

Examples

Median of an even-length sample

For with q = 0.5, method = linear: rank , so the result interpolates halfway between and , giving value .

95th percentile latency

Set q = 0.95 on a Vector of request latencies to read the tail (p95) that most SLAs target, unaffected by a few pathological outliers the mean would inflate.

Applications

  • Percentile SLAs (p50/p95/p99) on latency or error buffers.
  • Robust center/spread estimates (median, IQR) resistant to outliers.
  • Clipping thresholds derived from data quantiles rather than fixed limits.

Neat

The five interpolation modes mirror NumPy's percentile methods exactly, so results reproduce a `numpy.quantile` call bit-for-bit on the same data.

As an order statistic, a single extreme outlier moves the median by at most one rank — unlike the mean, which it can move arbitrarily far.

See also

quantilepercentilemedianorder-statisticrobuststateless