Class XTally

java.lang.Object
org.opentrafficsim.water.statistics.XTally
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
XPersistent, XTimeTally

public class XTally
extends java.lang.Object
implements java.io.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 java.lang.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 java.lang.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​(java.lang.String description)  
  • Method Summary

    Modifier and Type Method Description
    double[] getConfidenceInterval​(double alpha)
    returns the confidence interval on either side of the mean.
    double[] getConfidenceInterval​(double alpha, short side)
    returns the confidence interval based of the mean.
    java.lang.String getDescription()
    returns the description of this tally.
    double getMax()
    Returns the max.
    double getMin()
    Returns the min.
    long getN()
    Returns the number of observations.
    double getSampleMean()
    Returns the sampleMean of all oberservations since the initialization.
    double getSampleVariance()
    Returns the current tally variance.
    double getStdDev()
    Returns the current tally standard deviation.
    double getSum()
    returns the sum of the values of the observations.
    void initialize()
    initializes the Tally.
    boolean isInitialized()
    is this tally initialized?
    void tally​(double value)
    tally.
    java.lang.String toString()  
    int writeToExcel​(Sheet sheet, int startRow)
    Write statistics to an excel spreadsheet, starting on row "startRow".

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • 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 java.lang.String description
      description refers to the description of this tally.
    • semaphore

      protected java.lang.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 Details

    • XTally

      public XTally​(java.lang.String description)
      Parameters:
      description - String; description of the statistic
  • Method Details

    • 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, short 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 java.lang.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
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
      See Also:
      Object.toString()