Qu

iqr

Builtin index · Core maths

result = iqr(x)

Input: x · Output: result

What it is

Interquartile range: percentile(x,75) - percentile(x,25) — a spread measure robust to outliers, unlike std/var. x is a scalar, Vec, or Mat/Signal.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = iqr(x)
x scalar, Vec, Mat, or Signalnot documented yet
result scalar or Num
Returns a scalar Num.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

samples = randn(1000, 1)
print("mean={mean(samples)}  std={std(samples)}  iqr={iqr(samples)}")
print("p95={percentile(samples, 95)}")
output
mean=0.012612  std=1.005695  iqr=1.356399
p95=1.671269

from core-math

How it works

iqr(x) — interquartile range, percentile(x, 75) - percentile(x, 25): a spread measure robust to outliers, unlike std/var.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.