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, variancecount, DEFAULT_NAME, DEFAULT_NUMBER_FORMAT, maxObs, minObs, name, numberFormatEOL| 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, setSamplingTypeclone, getCount, getDataLine, getMaxObs, getMinObs, getName, newObservation, newObservation, newObservation, propertyChange, setName, setNumberFormat, toStringpublic static final java.util.logging.Logger log
protected double lastObservation
protected double sumOfSquares
public LinearSimpleStatsTimeVarying()
public LinearSimpleStatsTimeVarying(java.lang.String name)
public SamplingType getSamplingType()
SampleStatisticsgetSamplingType in interface SampleStatisticsgetSamplingType in class SimpleStatsTimeVaryingTIME_VARYING.public void reset()
SampleStatisticsreset in interface SampleStatisticsreset in class SimpleStatsTimeVaryingpublic void newObservation(double x)
SampleStatisticsnewObservation in interface SampleStatisticsnewObservation in class SimpleStatsTimeVaryingx - The new (primitive) observationpublic double getMean()
SampleStatisticsgetMean in interface SampleStatisticsgetMean in class SimpleStatsTimeVaryingpublic double getVariance()
SampleStatisticsgetVariance in interface SampleStatisticsgetVariance in class SimpleStatsTimeVarying