Class XTally

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    XPersistent, XTimeTally

    public class XTally
    extends Object
    implements Serializable

    Copyright (c) 2011-2013 TU Delft, Faculty of TBM, Systems and Simulation
    This software is licensed without restrictions to Nederlandse Organisatie voor Toegepast Natuurwetenschappelijk Onderzoek TNO (TNO), Erasmus University Rotterdam, Delft University of Technology, Panteia B.V., Stichting Projecten Binnenvaart, Ab Ovo Nederland B.V., Modality Software Solutions B.V., and Rijkswaterstaat - Dienst Water, Verkeer en Leefomgeving, including the right to sub-license sources and derived products to third parties.
    Version:
    Mar 24, 2013
    Author:
    Alexander Verbraeck
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static short BOTH_SIDE_CONFIDENCE
      BOTH_SIDE_CONFIDENCE refers to both sides of the confidence.
      protected String description
      description refers to the description of this tally.
      static short LEFT_SIDE_CONFIDENCE
      LEFT_SIDE_CONFIDENCE refers to the left side confidence.
      protected double max
      maxrefers to the max of the tally.
      protected double min
      min refers to the min of the tally.
      protected long n
      n refers to the number of measurements.
      static short RIGTH_SIDE_CONFIDENCE
      RIGTH_SIDE_CONFIDENCE refers to the right side confidence.
      protected Object semaphore
      the semaphore.
      protected double sum
      sum refers to the sum of the tally.
      protected double varianceSum
      varianceSum refers to the varianceSum of the tally.
    • Constructor Summary

      Constructors 
      Constructor Description
      XTally​(String description)  
    • Field Detail

      • sum

        protected double sum
        sum refers to the sum of the tally.
      • min

        protected double min
        min refers to the min of the tally.
      • max

        protected double max
        maxrefers to the max of the tally.
      • varianceSum

        protected double varianceSum
        varianceSum refers to the varianceSum of the tally.
      • n

        protected long n
        n refers to the number of measurements.
      • description

        protected String description
        description refers to the description of this tally.
      • semaphore

        protected Object semaphore
        the semaphore.
      • LEFT_SIDE_CONFIDENCE

        public static final short LEFT_SIDE_CONFIDENCE
        LEFT_SIDE_CONFIDENCE refers to the left side confidence.
        See Also:
        Constant Field Values
      • BOTH_SIDE_CONFIDENCE

        public static final short BOTH_SIDE_CONFIDENCE
        BOTH_SIDE_CONFIDENCE refers to both sides of the confidence.
        See Also:
        Constant Field Values
      • RIGTH_SIDE_CONFIDENCE

        public static final short RIGTH_SIDE_CONFIDENCE
        RIGTH_SIDE_CONFIDENCE refers to the right side confidence.
        See Also:
        Constant Field Values
    • Constructor Detail

      • XTally

        public XTally​(String description)
        Parameters:
        description - String; description of the statistic
    • Method Detail

      • getSampleMean

        public double getSampleMean()
        Returns the sampleMean of all oberservations since the initialization.
        Returns:
        double the sampleMean
      • getConfidenceInterval

        public double[] getConfidenceInterval​(double alpha)
        returns the confidence interval on either side of the mean.
        Parameters:
        alpha - double; Alpha is the significance level used to compute the confidence level. The confidence level equals 100*(1 - alpha)%, or in other words, an alpha of 0.05 indicates a 95 percent confidence level.
        Returns:
        double[] the confidence interval of this tally
      • getConfidenceInterval

        public double[] getConfidenceInterval​(double alpha,
                                              org.djutils.stats.ConfidenceInterval side)
        returns the confidence interval based of the mean.
        Parameters:
        alpha - double; Alpha is the significance level used to compute the confidence level. The confidence level equals 100*(1 - alpha)%, or in other words, an alpha of 0.05 indicates a 95 percent confidence level.
        side - short; the side of the confidence interval with respect to the mean
        Returns:
        double[] the confidence interval of this tally
      • getDescription

        public String getDescription()
        returns the description of this tally.
        Returns:
        Sting description
      • getMax

        public double getMax()
        Returns the max.
        Returns:
        double
      • getMin

        public double getMin()
        Returns the min.
        Returns:
        double
      • getN

        public long getN()
        Returns the number of observations.
        Returns:
        long n
      • getStdDev

        public double getStdDev()
        Returns the current tally standard deviation.
        Returns:
        double the standard deviation
      • getSum

        public double getSum()
        returns the sum of the values of the observations.
        Returns:
        double sum
      • getSampleVariance

        public double getSampleVariance()
        Returns the current tally variance.
        Returns:
        double samplevariance
      • initialize

        public void initialize()
        initializes the Tally. This methods sets the max, min, n, sum and variance values to their initial values.
      • isInitialized

        public boolean isInitialized()
        is this tally initialized?
        Returns:
        true whenever this.initialize is invoked.
      • tally

        public void tally​(double value)
        tally.
        Parameters:
        value - double; the value
      • writeToExcel

        public int writeToExcel​(Sheet sheet,
                                int startRow)
        Write statistics to an excel spreadsheet, starting on row "startRow".
        Parameters:
        sheet - Sheet; the excel sheet to write to
        startRow - int; the first row of writing
        Returns:
        first free row after writing