public class SampleStatistic
extends java.lang.Object
Statistics on a sampled value.
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: Note on a Method for Calculating Corrected Sums of Squares and Products
This algorithm is also described in Wikipedia in the section "Online algorithm": Algorithms for calculating variance.
Constructor and Description |
---|
SampleStatistic() |
Modifier and Type | Method and Description |
---|---|
long |
getCount() |
long |
getMax() |
double |
getMean() |
double |
getStdDev() |
long |
getTotal() |
double |
getVariance() |
void |
record(long sample)
Records a sample value.
|
void |
reset()
Resets the statistics.
|
void |
set(long sample)
Deprecated.
use
record(long) instead |
java.lang.String |
toString() |
public void reset()
public void record(long sample)
sample
- the value to record.@Deprecated public void set(long sample)
record(long)
insteadpublic 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–2018 Webtide. All rights reserved.