Class SampleStatistic
- java.lang.Object
-
- com.aspectran.core.util.statistic.SampleStatistic
-
public class SampleStatistic extends java.lang.ObjectSampledStatisticsProvides 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
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.atomic.AtomicLongcountprotected java.util.concurrent.atomic.LongAccumulatormaxprotected java.util.concurrent.atomic.AtomicLongtotalprotected java.util.concurrent.atomic.LongAddertotalVariance100
-
Constructor Summary
Constructors Constructor Description SampleStatistic()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetCount()longgetMax()doublegetMean()doublegetStdDev()longgetTotal()doublegetVariance()voidreset()voidset(long sample)java.lang.StringtoString()
-
-
-
Field Detail
-
max
protected final java.util.concurrent.atomic.LongAccumulator max
-
total
protected final java.util.concurrent.atomic.AtomicLong total
-
count
protected final java.util.concurrent.atomic.AtomicLong count
-
totalVariance100
protected final java.util.concurrent.atomic.LongAdder totalVariance100
-
-
Method Detail
-
reset
public void reset()
-
set
public void set(long sample)
-
getMax
public long getMax()
-
getTotal
public long getTotal()
-
getCount
public long getCount()
-
getMean
public double getMean()
-
getVariance
public double getVariance()
-
getStdDev
public double getStdDev()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-