standardDeviation

Computes the standard deviation of the values in this iterable.

The standard deviation is the square root of the variance. It has the same unit as the data, making it easier to interpret than variance.

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).standardDeviation() // 2.1380...

Return

the standard deviation of the elements.

Parameters

kind

whether to compute sample or population standard deviation. Defaults to PopulationKind.SAMPLE.


Computes the standard deviation of the values in this array.

The standard deviation is the square root of the variance.

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).standardDeviation() // 2.1380...

Return

the standard deviation of the array elements.

Parameters

kind

whether to compute sample or population standard deviation. Defaults to PopulationKind.SAMPLE.


Computes the standard deviation of the values in this sequence.

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

Return

the standard deviation of the elements.

Parameters

kind

whether to compute sample or population standard deviation. Defaults to PopulationKind.SAMPLE.


@JvmName(name = "standardDeviationOfLong")
fun Iterable<Long>.standardDeviation(kind: PopulationKind = PopulationKind.SAMPLE): Double(source)

Computes the standard deviation of the Long values.

Values are converted to Double internally. Long values whose absolute value exceeds 2^53 (9,007,199,254,740,992) may lose precision in the least-significant digits.

Example:

listOf(2L, 4L, 4L, 4L, 5L, 5L, 7L, 9L).standardDeviation() // 2.1380...

Return

the standard deviation of the Long values as a Double.

Parameters

kind

whether to compute sample or population standard deviation. Defaults to PopulationKind.SAMPLE.


@JvmName(name = "standardDeviationOfInt")
fun Iterable<Int>.standardDeviation(kind: PopulationKind = PopulationKind.SAMPLE): Double(source)

Computes the standard deviation of the Int values.

Values are converted to Double internally. The conversion is exact for all Int values.

Example:

listOf(2, 4, 4, 4, 5, 5, 7, 9).standardDeviation() // 2.1380...

Return

the standard deviation of the Int values as a Double.

Parameters

kind

whether to compute sample or population standard deviation. Defaults to PopulationKind.SAMPLE.