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.
| Modifier and Type | Field and Description |
|---|---|
| private final AtomicLong | |
| private final LongAccumulator | |
| private final AtomicLong | |
| private final LongAdder |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public long | |
| public long | |
| public double | Returns: the average value of the samples recorded, or zero if there are no samplesGet the average value of the samples recorded, or zero if there are no samples. |
| public double | Returns: the standard deviation of the samples recordedGet the standard deviation of the samples recorded. |
| public long | |
| public double | Returns: the variance of the samples recorded, or zero if there are less than 2 samplesGet the variance of the samples recorded, or zero if there are less than 2 samples. |
| public void | |
| public void | |
| public String |
| _count | back to summary |
|---|---|
| private final AtomicLong _count | |
| _max | back to summary |
|---|---|
| private final LongAccumulator _max | |
| _total | back to summary |
|---|---|
| private final AtomicLong _total | |
| _totalVariance100 | back to summary |
|---|---|
| private final LongAdder _totalVariance100 | |
| SampleStatistic | back to summary |
|---|---|
| public SampleStatistic() | |
| getCount | back to summary |
|---|---|
| public long getCount() Get the number of samples recorded.
| |
| getMax | back to summary |
|---|---|
| public long getMax() Get the max value of the recorded samples.
| |
| getMean | back to summary |
|---|---|
| public double getMean() Get the average value of the samples recorded, or zero if there are no samples.
| |
| getStdDev | back to summary |
|---|---|
| public double getStdDev() Get the standard deviation of the samples recorded.
| |
| getTotal | back to summary |
|---|---|
| public long getTotal() Get the sum of all the recorded samples.
| |
| getVariance | back to summary |
|---|---|
| public double getVariance() Get the variance of the samples recorded, or zero if there are less than 2 samples.
| |
| record | back to summary |
|---|---|
| public void record(long sample) Records a sample value.
| |
| reset | back to summary |
|---|---|
| public void reset() Resets the statistics. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |