Class SampleStatistics
java.lang.Object
math.SampleStatistics
Collect statistics related to given simulation samples
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected doubleprotected doubleprotected double[]protected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcomputes all the statistical parameters, using their respective mathematical formulaevoidThis method is called at the end of the loading phase.doublegets the sample coefficient of variationdouble[]Returns the distriburion intervals end.double[]Returns the distribution computed based on samplesdouble[]Returns the distribution intervals start.doubleReturns the interval max.doubleReturns the interval min.doubleReturns the interval width.doublegets the sample kurtosisdoublegetMax()gets the greatest valuedoubleReturns the max sim time.doublegetMean()gets the sample meandoublegetMin()gets the smallest valuedoubleReturns the min sim time.doublegets the sample 2nd momentdoublegets the sample 3rd momentdoublegets the sample 4th momentdoublegets the number of samplesdoublegetSkew()gets the sample skewnessdoublegets the sample standard deviationdoublegets the sample variancevoidinitializeDistrubution(double intervalMin, double intervalMax, int intervals) Tells that this sample statistic should also populate distributions.booleanChecks whether distribution available.voidputNewSample(double sample, double weight, double simulationTime) updates the max, min, sum of weights with the new value.toString()creates a string with the calculated parameters of the sequence monitored by SampleStatistics
-
Field Details
-
n
protected double n -
max
protected double max -
min
protected double min -
totalWeight
protected double totalWeight -
weigthedSum1
protected double weigthedSum1 -
weigthedSum2
protected double weigthedSum2 -
weigthedSum3
protected double weigthedSum3 -
weigthedSum4
protected double weigthedSum4 -
minSimTime
protected double minSimTime -
maxSimTime
protected double maxSimTime -
canInitializeIntervals
protected boolean canInitializeIntervals -
intervalWidth
protected double intervalWidth -
intervalMin
protected double intervalMin -
intervalMax
protected double intervalMax -
totalIntervalWeights
protected double totalIntervalWeights -
intervalWeights
protected double[] intervalWeights
-
-
Constructor Details
-
SampleStatistics
public SampleStatistics()Creates a new instance of SampleStatistics
-
-
Method Details
-
putNewSample
public void putNewSample(double sample, double weight, double simulationTime) updates the max, min, sum of weights with the new value.- Parameters:
sample- the value of the new sampleweight- the weight of the new samplesimulationTime- the simulation time for the new sample
-
initializeDistrubution
public void initializeDistrubution(double intervalMin, double intervalMax, int intervals) Tells that this sample statistic should also populate distributions. This method must be called before samples are collected- Parameters:
intervalMin- the minimum value of samples to collect in intervalsintervalMax- the maximum value of samples to collect in intervalsintervals- the number of intervals to build- Throws:
IllegalStateException- if this method is called after addSample
-
getDistribution
Returns the distribution computed based on samples- Parameters:
type- the type of distribution- Returns:
- the distribution if initialized, null otherwise.
-
getDistributionIntervalsStart
public double[] getDistributionIntervalsStart()Returns the distribution intervals start.- Returns:
- the start point for intervals of the distribution
-
getDistriburionIntervalsEnd
public double[] getDistriburionIntervalsEnd()Returns the distriburion intervals end.- Returns:
- the end point for intervals of the distribution
-
calcStatistics
protected void calcStatistics()computes all the statistical parameters, using their respective mathematical formulae -
getMean
public double getMean()gets the sample mean- Returns:
- the actual sample mean
-
getMoment2
public double getMoment2()gets the sample 2nd moment- Returns:
- the actual 2nd moment
-
getMoment3
public double getMoment3()gets the sample 3rd moment- Returns:
- the actual 3rd moment
-
getMoment4
public double getMoment4()gets the sample 4th moment- Returns:
- the actual 4th moment
-
getVariance
public double getVariance()gets the sample variance- Returns:
- the actual variance
-
getStandardDeviation
public double getStandardDeviation()gets the sample standard deviation- Returns:
- the actual standard deviation
-
getCoefficienfOfVariation
public double getCoefficienfOfVariation()gets the sample coefficient of variation- Returns:
- the actual coefficient of variation
-
getSkew
public double getSkew()gets the sample skewness- Returns:
- the actual skewness
-
getKurtosis
public double getKurtosis()gets the sample kurtosis- Returns:
- the actual kurtosis
-
getMax
public double getMax()gets the greatest value- Returns:
- the actual max value
-
getMin
public double getMin()gets the smallest value- Returns:
- the actual min value
-
getSamples
public double getSamples()gets the number of samples- Returns:
- the actual number of samples
-
getMinSimTime
public double getMinSimTime()Returns the min sim time.- Returns:
- the minimum simulation time
-
getMaxSimTime
public double getMaxSimTime()Returns the max sim time.- Returns:
- the maximum simulation time
-
toString
-
getIntervalWidth
public double getIntervalWidth()Returns the interval width.- Returns:
- the width of each interval used by the distribution
-
getIntervalMin
public double getIntervalMin()Returns the interval min.- Returns:
- the minimum value of the intervals considered for distribution (inclusive)
-
getIntervalMax
public double getIntervalMax()Returns the interval max.- Returns:
- the maximum value of the intervals considered for distribution (inclusive)
-
isDistributionAvailable
public boolean isDistributionAvailable()Checks whether distribution available.- Returns:
- true if distribution is available, false otherwise.
-
finalizeLoading
public void finalizeLoading()This method is called at the end of the loading phase.
-