public class SampleStatistic
extends java.lang.Object
Provides max, total, mean, count, variance, and standard deviation of continuous sequence of samples.
Calculates estimates of mean, variance, and standard deviation characteristics of a sample using a non synchronized approximation of the on-line algorithm presented in Donald Knuth's Art of Computer Programming, Volume 2, Semi numerical Algorithms, 3rd edition, page 232, Boston: Addison-Wesley. that cites a 1962 paper by B.P. Welford that can be found by following Note on a Method for Calculating Corrected Sums of Squares and Products
This algorithm is also described in Wikipedia at Algorithms for calculating variance
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.atomic.AtomicLong |
_count |
protected java.util.concurrent.atomic.LongAccumulator |
_max |
protected java.util.concurrent.atomic.AtomicLong |
_total |
protected java.util.concurrent.atomic.LongAdder |
_totalVariance100 |
Constructor and Description |
---|
SampleStatistic() |
Modifier and Type | Method and Description |
---|---|
long |
getCount() |
long |
getMax() |
double |
getMean() |
double |
getStdDev() |
long |
getTotal() |
double |
getVariance() |
void |
reset() |
void |
set(long sample) |
java.lang.String |
toString() |
protected final java.util.concurrent.atomic.LongAccumulator _max
protected final java.util.concurrent.atomic.AtomicLong _total
protected final java.util.concurrent.atomic.AtomicLong _count
protected final java.util.concurrent.atomic.LongAdder _totalVariance100
public void reset()
public void set(long sample)
public long getMax()
public long getTotal()
public long getCount()
public double getMean()
public double getVariance()
public double getStdDev()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 1995–2017 Webtide. All rights reserved.