Class WelfordMoments
java.lang.Object
dev.frostlake.functions.aggregate.WelfordMoments
The running count, mean and sum of squared deviations of a double series — Welford's update,
merged with Chan's formula — which the variance family uses over EXACT inputs. Those answers are
presented at a declared scale, which a double carrying the running mean reaches without the
cancellation a sum of squares suffers: live, VARIANCE over the NUMBERs 100000000, 100000001 and
100000002 is 1.000000.
Over FLOATs the account reads sums instead, digit for digit — see SquaredSumMoments.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(double value) Fold one value in.longcount()voidmerge(WelfordMoments other) Fold another series' moments in (Chan's parallel form).doubleThe population variance (denominator n); the caller checks there is a row at least.voidreset()doubleThe sample variance (denominator n - 1); the caller checks there are two rows at least.
-
Constructor Details
-
WelfordMoments
public WelfordMoments()
-
-
Method Details
-
add
public void add(double value) Fold one value in. -
merge
Fold another series' moments in (Chan's parallel form). -
count
public long count() -
sampleVariance
public double sampleVariance()The sample variance (denominator n - 1); the caller checks there are two rows at least. -
populationVariance
public double populationVariance()The population variance (denominator n); the caller checks there is a row at least. -
reset
public void reset()
-