public class LinearSimpleStatsTimeVarying extends SimpleStatsTimeVarying
A SimpleStats that computes the basic statistics for piecewise linear functions. An example is the inventory level. However, you must make sure that "jumps" (as in replenishments) have two property changes fired - one at the "bottom" of the level just before replenishment, and one at the "top", just after replenishment. Also, make sure that a final property change is fired at the very end so the last bit can be taken into account.
The mean is computed using the "Kalman Filter" version that protects against overflow. However, the variance (the one most likely to overflow) is done in the "sum-of-squares" manner, mostly because I havn't had a chance to work out the Kalman Filter for the variance.
Modifier and Type | Field and Description |
---|---|
protected double |
lastObservation |
static java.util.logging.Logger |
log |
protected double |
sumOfSquares |
diff, eventList, lastTime, mean, startTime, variance
count, DEFAULT_NAME, DEFAULT_NUMBER_FORMAT, maxObs, minObs, name, numberFormat
EOL
Constructor and Description |
---|
LinearSimpleStatsTimeVarying() |
LinearSimpleStatsTimeVarying(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
double |
getMean()
Gets the current value of the mean.
|
SamplingType |
getSamplingType()
Returns the SamplingType for this SampleStatistics.
|
double |
getVariance()
Gets the current value of the variance.
|
void |
newObservation(double x)
Add new observation and update counters (primitive).
|
void |
reset()
Should reset/initialize all relevant counters.
|
getEventList, getEventListID, getStandardDeviation, getStartTime, setEventList, setEventListID, setSamplingType
clone, getCount, getDataLine, getMaxObs, getMinObs, getName, newObservation, newObservation, newObservation, propertyChange, setName, setNumberFormat, toString
public static final java.util.logging.Logger log
protected double lastObservation
protected double sumOfSquares
public LinearSimpleStatsTimeVarying()
public LinearSimpleStatsTimeVarying(java.lang.String name)
public SamplingType getSamplingType()
SampleStatistics
getSamplingType
in interface SampleStatistics
getSamplingType
in class SimpleStatsTimeVarying
TIME_VARYING
.public void reset()
SampleStatistics
reset
in interface SampleStatistics
reset
in class SimpleStatsTimeVarying
public void newObservation(double x)
SampleStatistics
newObservation
in interface SampleStatistics
newObservation
in class SimpleStatsTimeVarying
x
- The new (primitive) observationpublic double getMean()
SampleStatistics
getMean
in interface SampleStatistics
getMean
in class SimpleStatsTimeVarying
public double getVariance()
SampleStatistics
getVariance
in interface SampleStatistics
getVariance
in class SimpleStatsTimeVarying