interquartileRange

fun Iterable<Double>.interquartileRange(method: QuantileMethod = QuantileMethod.LINEAR): Double(source)

Computes the interquartile range (IQR) of the values in this iterable.

The IQR is the difference between the third quartile (Q3, 75th percentile) and the first quartile (Q1, 25th percentile). It measures the spread of the middle 50% of the data and is robust to outliers.

Example:

listOf(1.0, 2.0, 3.0, 4.0, 5.0).interquartileRange() // 2.0

Return

the interquartile range (Q3 - Q1).

Parameters

method

the quantile estimation method. Defaults to QuantileMethod.LINEAR (HF7).


fun DoubleArray.interquartileRange(method: QuantileMethod = QuantileMethod.LINEAR): Double(source)

Computes the interquartile range (IQR) of the values in this array.

The IQR is the difference between Q3 (75th percentile) and Q1 (25th percentile).

Example:

doubleArrayOf(1.0, 2.0, 3.0, 4.0, 5.0).interquartileRange() // 2.0

Return

the interquartile range (Q3 - Q1).

Parameters

method

the quantile estimation method. Defaults to QuantileMethod.LINEAR (HF7).


fun Sequence<Double>.interquartileRange(method: QuantileMethod = QuantileMethod.LINEAR): Double(source)

Computes the interquartile range (IQR) of the values in this sequence.

The sequence is materialized internally. See DoubleArray.interquartileRange for details.

Return

the interquartile range (Q3 - Q1).

Parameters

method

the quantile estimation method. Defaults to QuantileMethod.LINEAR (HF7).