centralMoment

Computes the n-th central moment of the values.

The r-th central moment is the average of the r-th power of deviations from the mean, dividing by n (population-style). Order 0 returns 1.0 by convention, order 1 returns 0.0 by definition, and order 2 equals the population variance. Odd central moments measure asymmetry, while even central moments measure tail weight.

Uses a two-pass algorithm with z-normalization (dividing deviations by the standard deviation) to prevent overflow with large-magnitude data.

Example:

listOf(2.0, 4.0, 4.0, 4.0, 5.0, 5.0, 7.0, 9.0).centralMoment(2) // 4.0
listOf(2.0, 4.0, 4.0, 4.0, 5.0, 5.0, 7.0, 9.0).centralMoment(3) // 5.25

Return

the central moment of the given order.

Parameters

order

the moment order. Must be non-negative.

See also


Computes the n-th central moment of the values.

The r-th central moment is the average of the r-th power of deviations from the mean, dividing by n (population-style). Order 0 returns 1.0 by convention, order 1 returns 0.0 by definition, and order 2 equals the population variance. Odd central moments measure asymmetry, while even central moments measure tail weight.

Uses a two-pass algorithm with z-normalization (dividing deviations by the standard deviation) to prevent overflow with large-magnitude data.

Example:

doubleArrayOf(2.0, 4.0, 4.0, 4.0, 5.0, 5.0, 7.0, 9.0).centralMoment(2) // 4.0
doubleArrayOf(2.0, 4.0, 4.0, 4.0, 5.0, 5.0, 7.0, 9.0).centralMoment(3) // 5.25

Return

the central moment of the given order.

Parameters

order

the moment order. Must be non-negative.

See also


Computes the n-th central moment of the values in this sequence.

The r-th central moment is the average of the r-th power of deviations from the mean, dividing by n (population-style). Order 0 returns 1.0 by convention, order 1 returns 0.0 by definition, and order 2 equals the population variance. Odd central moments measure asymmetry, while even central moments measure tail weight.

Uses a two-pass algorithm with z-normalization (dividing deviations by the standard deviation) to prevent overflow with large-magnitude data. The sequence is materialized into a list internally.

Example:

sequenceOf(2.0, 4.0, 4.0, 4.0, 5.0, 5.0, 7.0, 9.0).centralMoment(2) // 4.0
sequenceOf(2.0, 4.0, 4.0, 4.0, 5.0, 5.0, 7.0, 9.0).centralMoment(3) // 5.25

Return

the central moment of the given order.

Parameters

order

the moment order. Must be non-negative.

See also