kumulant

MomentsResult

@Serializable
@SerialName(value = "MomentsResult")
data class MomentsResult(val totalWeights: Double, val mean: Double, val m2: Double, val m3: Double, val m4: Double) : Result, HasSampleVariance, HasShapeMoments, HasCenterScale(source)

First four central moments (m2..m4) plus mean and total weight.

Constructors

MomentsResult

constructor(totalWeights: Double, mean: Double, m2: Double, m3: Double, m4: Double)(source)

Properties

center

open override val center: Double(source)

Center of the distribution; typically a mean, median, or smoothed level.

m2

open override val m2: Double(source)

Raw 2nd central moment: Sum (x - mean)^2 * weight. Identical to sst.

m3

open override val m3: Double(source)

Raw 3rd central moment: Sum (x - mean)^3 * weight.

m4

open override val m4: Double(source)

Raw 4th central moment: Sum (x - mean)^4 * weight.

mean

Weighted running mean.

scale

open override val scale: Double(source)

Scale of the distribution; typically a standard deviation, MAD, or span.

sst

open override 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.

totalWeights

open override val totalWeights: Double(source)

Cumulative weight of observations folded into this result.

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
open val kurtosis: Double

Biased excess kurtosis: (m4 / w) / variance^2 - 3. Heavy tails are positive; the - 3 normalises so that a Gaussian has excess kurtosis 0.

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard
open val skewness: Double

Biased skewness: (m3 / w) / variance^1.5. Standardised third moment; 0 for symmetric distributions, positive for right tails, negative for left tails.

Link copied to clipboard
open val stdDev: Double

Population standard deviation: sqrt([variance]).

Link copied to clipboard

Sample-size-adjusted (unbiased) excess kurtosis. Zero when totalWeights <= 3.

Link copied to clipboard

Sample-size-adjusted (unbiased) skewness. Zero when totalWeights <= 2.

Link copied to clipboard
open val variance: Double

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