quartiles

fun Iterable<Double>.quartiles(method: QuantileMethod = QuantileMethod.LINEAR): Triple<Double, Double, Double>(source)

Computes the three quartiles (Q1, Q2, Q3) of the values in this iterable.

Q1 (25th percentile), Q2 (median, 50th percentile), and Q3 (75th percentile) divide the data into four equal-frequency groups. The data is sorted once and reused for all three quartile computations.

Example:

val (q1, q2, q3) = listOf(1.0, 2.0, 3.0, 4.0, 5.0).quartiles()
// q1 = 2.0, q2 = 3.0, q3 = 4.0

Return

a Triple of (Q1, Q2, Q3).

Parameters

method

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


fun DoubleArray.quartiles(method: QuantileMethod = QuantileMethod.LINEAR): Triple<Double, Double, Double>(source)

Computes the three quartiles (Q1, Q2, Q3) of the values in this array.

Q1 (25th percentile), Q2 (median, 50th percentile), and Q3 (75th percentile) divide the data into four equal-frequency groups.

Example:

val (q1, q2, q3) = doubleArrayOf(1.0, 2.0, 3.0, 4.0, 5.0).quartiles()
// q1 = 2.0, q2 = 3.0, q3 = 4.0

Return

a Triple of (Q1, Q2, Q3).

Parameters

method

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


fun Sequence<Double>.quartiles(method: QuantileMethod = QuantileMethod.LINEAR): Triple<Double, Double, Double>(source)

Computes the three quartiles (Q1, Q2, Q3) of the values in this sequence.

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

Return

a Triple of (Q1, Q2, Q3).

Parameters

method

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