variance

fun variance(kind: PopulationKind = SAMPLE): Double(source)

Computes the variance of all observations.

Returns Double.NaN if there are fewer observations than required (at least 2 for PopulationKind.SAMPLE, at least 1 for PopulationKind.POPULATION).

Return

the variance, or Double.NaN if insufficient data.

Parameters

kind

whether to compute sample variance (divides by n-1) or population variance (divides by n). Defaults to PopulationKind.SAMPLE.