kurtosis

fun Iterable<Double>.kurtosis(kind: PopulationKind = SAMPLE, excess: Boolean = true): Double(source)

Computes the kurtosis of the values in this iterable.

Kurtosis measures the "tailedness" of a distribution relative to a normal distribution. Higher kurtosis indicates heavier tails and a sharper peak. By default, computes excess kurtosis (subtracting 3 so that a normal distribution has kurtosis 0). Uses a two-pass algorithm with z-normalization for numerical stability.

NaN values propagate through the computation (IEEE 754 semantics): if any element is NaN, the result is NaN. Filter NaN values before calling this function if that is not desired.

Example:

listOf(2.0, 4.0, 4.0, 4.0, 5.0, 5.0, 7.0, 9.0).kurtosis() // -0.151...
listOf(2.0, 4.0, 4.0, 4.0, 5.0, 5.0, 7.0, 9.0).kurtosis(excess = false) // 2.848...

Return

the kurtosis. Returns -3.0 (excess) or 0.0 (non-excess) if variance is zero.

Parameters

kind

whether to compute sample-adjusted or population kurtosis. Defaults to PopulationKind.SAMPLE, which applies bias correction.

excess

whether to subtract 3 (the kurtosis of a normal distribution). Defaults to true. Set to false for raw kurtosis.


fun DoubleArray.kurtosis(kind: PopulationKind = SAMPLE, excess: Boolean = true): Double(source)

Computes the kurtosis of the values in this array.

Kurtosis measures the "tailedness" of a distribution relative to a normal distribution. Higher kurtosis indicates heavier tails and a sharper peak.

NaN values propagate through the computation (IEEE 754 semantics): if any element is NaN, the result is NaN. Filter NaN values before calling this function if that is not desired.

Example:

doubleArrayOf(2.0, 4.0, 4.0, 4.0, 5.0, 5.0, 7.0, 9.0).kurtosis() // -0.151...

Return

the kurtosis. Returns -3.0 (excess) or 0.0 (non-excess) if variance is zero.

Parameters

kind

whether to compute sample-adjusted or population kurtosis. Defaults to PopulationKind.SAMPLE, which applies bias correction.

excess

whether to subtract 3 (the kurtosis of a normal distribution). Defaults to true. Set to false for raw kurtosis.


fun Sequence<Double>.kurtosis(kind: PopulationKind = SAMPLE, excess: Boolean = true): Double(source)

Computes the kurtosis of the values in this sequence.

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

Return

the kurtosis. Returns -3.0 (excess) or 0.0 (non-excess) if variance is zero.

Parameters

kind

whether to compute sample-adjusted or population kurtosis. Defaults to PopulationKind.SAMPLE.

excess

whether to subtract 3 (the kurtosis of a normal distribution). Defaults to true.