Package jasima.core.statistics
Class TimeWeightedSummaryStat
- java.lang.Object
-
- jasima.core.statistics.SummaryStat
-
- jasima.core.statistics.TimeWeightedSummaryStat
-
- All Implemented Interfaces:
Serializable,Cloneable
public class TimeWeightedSummaryStat extends SummaryStat
ASummaryStatwhich weights values according to the time. As result statistics the values returned bySummaryStat.mean(),min(), andmax()have defined values.- Author:
- Torsten Hildebrandt
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class jasima.core.statistics.SummaryStat
DEF_ERROR_PROB, lastValue, lastWeight
-
-
Constructor Summary
Constructors Constructor Description TimeWeightedSummaryStat()Constructs a new instance withlastTimeandlastValueinitialized with 0.TimeWeightedSummaryStat(TimeWeightedSummaryStat s)Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Resets this object.TimeWeightedSummaryStatclone()Clones this object.doublelastTime()Returns the current value of the attributelastTime.doublemax()Returns the maximum value seen so far.doublemin()Returns the minimum value seen so far.TimeWeightedSummaryStatvalue(double v)Don't use this method as it doesn't make sense for aTimeWeightedSummaryStat.TimeWeightedSummaryStatvalue(double value, double time)doublevariance()Returns the sample variance of the values.doublevariancePopulation()Returns the population variance of the values.-
Methods inherited from class jasima.core.statistics.SummaryStat
combine, combine, confidenceIntervalLower, confidenceIntervalLower, confidenceIntervalUpper, confidenceIntervalUpper, confIntRangeSingle, lastValue, lastWeight, mean, numObs, stdDev, sum, summarize, summarize, values, varCoeff, weightSum
-
-
-
-
Constructor Detail
-
TimeWeightedSummaryStat
public TimeWeightedSummaryStat()
Constructs a new instance withlastTimeandlastValueinitialized with 0.
-
TimeWeightedSummaryStat
public TimeWeightedSummaryStat(TimeWeightedSummaryStat s)
Copy constructor.- Parameters:
s- The object to copy.
-
-
Method Detail
-
clear
public void clear()
Description copied from class:SummaryStatResets this object.- Overrides:
clearin classSummaryStat
-
value
public TimeWeightedSummaryStat value(double value, double time)
Adds a newvalue, weighted by the difference betweentimeandlastTime().timeis then saved for the next invocation of this method.- Overrides:
valuein classSummaryStat- Parameters:
value- Value of some state variable from the point in time given as the second parameter.time- The point in time from which the current value isvalue- Returns:
thisto allow easy chaining of calls.
-
value
public TimeWeightedSummaryStat value(double v)
Don't use this method as it doesn't make sense for aTimeWeightedSummaryStat. Raises anUnsupportedOperationExceptionwhen called.- Overrides:
valuein classSummaryStat- Parameters:
v- ignored- Returns:
- TimeWeightedSummaryStat ignored
-
min
public double min()
Description copied from class:SummaryStatReturns the minimum value seen so far.- Overrides:
minin classSummaryStat- Returns:
- The minimum value seen so far, or NaN, if no values were given so far.
-
max
public double max()
Description copied from class:SummaryStatReturns the maximum value seen so far.- Overrides:
maxin classSummaryStat- Returns:
- The maximum value seen so far, or NaN, if no values were given so far.
-
variance
public double variance()
Description copied from class:SummaryStatReturns the sample variance of the values.- Overrides:
variancein classSummaryStat- Returns:
- The (sample) variance of all values given to
SummaryStat.value(double). Returns NaN, if no values were added yet.
-
variancePopulation
public double variancePopulation()
Description copied from class:SummaryStatReturns the population variance of the values.- Overrides:
variancePopulationin classSummaryStat- Returns:
- The (sample) variance of all values given to
SummaryStat.value(double). Returns NaN, if no values were added yet.
-
lastTime
public double lastTime()
Returns the current value of the attributelastTime.- Returns:
- The last point in time for which
value(double, double)was called. - See Also:
SummaryStat.lastValue()
-
clone
public TimeWeightedSummaryStat clone()
Description copied from class:SummaryStatClones this object. We can use the standard functionality here, as there are only primitive fields.- Overrides:
clonein classSummaryStat- Returns:
- A clone of this
SummaryStat.
-
-