|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SampleManager
public class SampleManager
SampleManager keeps track of aggregate information about your data samples: minimum and maximum values and estimates of arithmetic mean, variance, and standard deviation. It requires constant space independently of the number of samples added.
Field Summary | |
---|---|
protected double |
lag1sum
|
protected double |
lastSample
|
protected double |
max
|
protected double |
min
|
protected int |
nextValPos
|
protected int |
numSamples
|
protected long |
seed
|
protected double |
stdDev
|
protected double |
sumX
|
protected double |
sumXSquared
|
protected double |
variance
|
protected double |
xbar
|
Constructor Summary | |
---|---|
SampleManager()
Constructs a new SampleManager instance. |
Method Summary | |
---|---|
void |
addSample(double sample)
Records a sample value, updating sample count, min and max values, and mean and variance estimates. |
double |
getMax()
Returns the maximum value seen so far. |
double |
getMean()
Returns the arithmetic mean of sample values seen so far. |
double |
getMin()
Returns the minimum value seen so far. |
double |
getStdDev()
Returns the standard deviation of sample values seen so far. |
double |
getVariance()
Returns the variance of sample values seen so far. |
int |
numSamples()
Returns the number of sample values seen so far. |
protected void |
updateEstimates(double sample)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int numSamples
protected double sumX
protected double sumXSquared
protected double xbar
protected double variance
protected double stdDev
protected long seed
protected double max
protected double min
protected double lag1sum
protected double lastSample
protected int nextValPos
Constructor Detail |
---|
public SampleManager()
Method Detail |
---|
protected final void updateEstimates(double sample)
public final void addSample(double sample)
sample
- the sample to record.public final int numSamples()
public final double getMean()
public final double getVariance()
public final double getStdDev()
public final double getMax()
public final double getMin()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |