coefficientOfVariation

Computes the coefficient of variation (CV) of the values in this iterable.

The CV is the ratio of the standard deviation to the mean (sd / mean, not sd / |mean|). It expresses variability as a proportion of the mean, which is useful for comparing the spread of datasets with different units or scales. The mean must not be zero. Note that the result is negative when the mean is negative, consistent with scipy's variation().

Example:

listOf(2.0, 4.0, 4.0, 4.0, 5.0, 5.0, 7.0, 9.0).coefficientOfVariation() // 0.4276...

Return

the coefficient of variation (standard deviation / mean).

Parameters

kind

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

Throws

if the mean is zero.


Computes the coefficient of variation (CV) of the values in this array.

The CV is the ratio of the standard deviation to the mean (sd / mean, not sd / |mean|). The mean must not be zero. Note that the result is negative when the mean is negative, consistent with scipy's variation().

Example:

doubleArrayOf(2.0, 4.0, 4.0, 4.0, 5.0, 5.0, 7.0, 9.0).coefficientOfVariation() // 0.4276...

Return

the coefficient of variation (standard deviation / mean).

Parameters

kind

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

Throws

if the mean is zero.


Computes the coefficient of variation (CV) of the values in this sequence.

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

Return

the coefficient of variation (standard deviation / mean).

Parameters

kind

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