median-hilow

Median plus a central interval covering conf proportion of the data.

Quantiles use the type-7 / numpy default linear interpolation rule, the same convention as src/stat/boxplot.typ. The default conf: 0.5 returns the median with the IQR (25th to 75th percentile).

Usage

median-hilow(
  values,
  conf: 0.5,
)

Parameters

Parameter Default Description
values Array of numbers; non-numeric entries are dropped.
conf 0.5 Proportion of the data covered by the interval, in (0, 1).

Returns

Dict (y, ymin, ymax); all-none if values has no numerics.

Examples

Default 50% interval returns the median plus the IQR.

#let s = median-hilow((1, 2, 3, 4, 5, 6, 7, 8))

A 90% interval covers the bulk of the data while still trimming the tails.

#let s = median-hilow((1, 2, 3, 4, 5, 6, 7, 8, 9, 10), conf: 0.9)
Back to top