Class SampleStatistics

java.lang.Object
math.SampleStatistics

public class SampleStatistics extends Object
Collect statistics related to given simulation samples
  • 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 sample
      weight - the weight of the new sample
      simulationTime - 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 intervals
      intervalMax - the maximum value of samples to collect in intervals
      intervals - the number of intervals to build
      Throws:
      IllegalStateException - if this method is called after addSample
    • getDistribution

      public double[] getDistribution(SampleStatistics.DistributionType type)
      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

      public String toString()
      creates a string with the calculated parameters of the sequence monitored by SampleStatistics
      Overrides:
      toString in class Object
      Returns:
      a string
    • 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.