kumulant

HasSampleVariance

Result trait for accumulators that expose variance-family quantities. Derived properties variance / stdDev / sampleVariance / sampleStdDev all fall out of sst (sum of squared deviations) and totalWeights without storing redundant fields.

Implemented by every Welford-shaped result (com.eignex.kumulant.stat.summary.WeightedVarianceResult, com.eignex.kumulant.stat.summary.MomentsResult, the decay-family counterparts) and indirectly by HasShapeMoments and HasRegression.

The population vs sample distinction matters when sample size is small. Use sampleVariance / sampleStdDev when treating the observations as draws from an underlying distribution; use variance / stdDev when treating the observations as the complete population.

Inheritors

Properties

sampleStdDev

Unbiased sample standard deviation: sqrt([sampleVariance]).

sampleVariance

Unbiased sample variance: [sst] / ([totalWeights] - 1). Zero when totalWeights <= 1.

sst

open val sst: Double(source)

Sum of squared deviations from the running mean: Sum (x - mean)^2 * weight.

Implementors must override this or variance; the two are defined in terms of each other, so overriding neither recurses until the stack runs out. Every Result in the library overrides sst, which is the cheaper of the two to carry.

stdDev

open val stdDev: Double(source)

Population standard deviation: sqrt([variance]).

variance

Population variance: [sst] / [totalWeights]. Zero on an empty stream.

Link copied to clipboard
open val isEmpty: Boolean

True when no observation has been folded in, so every other field is a placeholder.

Link copied to clipboard
abstract val totalWeights: Double

Cumulative weight of observations folded into this result.