nl.tudelft.simulation.jstats.statistics
Class Tally

java.lang.Object
  extended by nl.tudelft.simulation.event.EventProducer
      extended by nl.tudelft.simulation.jstats.statistics.StatisticsObject
          extended by nl.tudelft.simulation.jstats.statistics.Tally
All Implemented Interfaces:
Serializable, EventListener, EventListenerInterface, EventProducerInterface, Swingable
Direct Known Subclasses:
Persistent

public class Tally
extends StatisticsObject
implements EventListenerInterface

The Tally class defines a statistics event tally.

(c) copyright 2002-2005-2004 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: Lesser General Public License (LGPL) , no warranty.

Since:
1.2
Version:
$Revision: 1.1 $ $Date: 2007/01/06 13:25:43 $
Author:
Peter Jacobs
See Also:
Serialized Form

Field Summary
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
static EventType MAX_EVENT
          MAX_EVENT is fired whenever a new maximum value has reached
protected  double min
          min refers to the min of the tally
static EventType MIN_EVENT
          MIN_EVENT is fired whenever a new minimum value has reached
protected  long n
          n refers to the number of measurements
static EventType N_EVENT
          N_EVENT is fired whenever on a change in measurements
static short RIGTH_SIDE_CONFIDENCE
          RIGTH_SIDE_CONFIDENCE refers to the right side confidence
static EventType SAMPLE_MEAN_EVENT
          SAMPLE_MEAN_EVENT is fired whenever the sample mean is updated
static EventType SAMPLE_VARIANCE_EVENT
          SAMPLE_VARIANCE_EVENT is fired whenever the sample variance is updated
protected  double sampleMean
          sampleMean refers to the mean of the tally
protected  Object semaphore
          the semaphore
static EventType STANDARD_DEVIATION_EVENT
          STANDARD_DEVIATION_EVENT is fired whenever the standard deviation is updated
protected  double sum
          sum refers to the sum of the tally
static EventType SUM_EVENT
          SUM_EVENT is fired whenever the sum sis updated
protected  double varianceSum
          varianceSum refers to the varianceSum of the tally
 
Fields inherited from class nl.tudelft.simulation.jstats.statistics.StatisticsObject
filter
 
Fields inherited from class nl.tudelft.simulation.event.EventProducer
listeners
 
Fields inherited from interface nl.tudelft.simulation.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
 
Constructor Summary
Tally(String description)
          Constructs a new Tally
 
Method Summary
 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
 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
 TableModel getTable()
          represents the statistics object as Table.
 void initialize()
          initializes the Tally.
 boolean isInitialized()
          is this tally initialized?
 void notify(EventInterface event)
           
 void setFilter(Filterinterface filter)
          sets the Filter on this tally
protected  double setMax(double max)
          sets max
protected  double setMin(double min)
          sets min
protected  long setN(long n)
          sets n
protected  double setSampleMean(double sampleMean)
          sets sampleMean
protected  double setSum(double sum)
          sets the count
 String toString()
           
 
Methods inherited from class nl.tudelft.simulation.jstats.statistics.StatisticsObject
getSwingPanel
 
Methods inherited from class nl.tudelft.simulation.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, getEventTypes, removeAllListeners, removeAllListeners, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SAMPLE_MEAN_EVENT

public static final EventType SAMPLE_MEAN_EVENT
SAMPLE_MEAN_EVENT is fired whenever the sample mean is updated


SAMPLE_VARIANCE_EVENT

public static final EventType SAMPLE_VARIANCE_EVENT
SAMPLE_VARIANCE_EVENT is fired whenever the sample variance is updated


MIN_EVENT

public static final EventType MIN_EVENT
MIN_EVENT is fired whenever a new minimum value has reached


MAX_EVENT

public static final EventType MAX_EVENT
MAX_EVENT is fired whenever a new maximum value has reached


N_EVENT

public static final EventType N_EVENT
N_EVENT is fired whenever on a change in measurements


STANDARD_DEVIATION_EVENT

public static final EventType STANDARD_DEVIATION_EVENT
STANDARD_DEVIATION_EVENT is fired whenever the standard deviation is updated


SUM_EVENT

public static final EventType SUM_EVENT
SUM_EVENT is fired whenever the sum sis updated


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

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


sampleMean

protected double sampleMean
sampleMean refers to the mean 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

Constructor Detail

Tally

public Tally(String description)
Constructs a new Tally

Parameters:
description - the description of this tally
Method Detail

setFilter

public void setFilter(Filterinterface filter)
sets the Filter on this tally

Parameters:
filter - the filter.

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 - 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 - 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 - 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

getTable

public TableModel getTable()
Description copied from class: StatisticsObject
represents the statistics object as Table.

Specified by:
getTable in class StatisticsObject
Returns:
TableModel the result
See Also:
StatisticsObject.getTable()

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.

notify

public void notify(EventInterface event)
Specified by:
notify in interface EventListenerInterface
See Also:
#notify(nl.tudelft.simulation.event.EventInterface)

toString

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

setSampleMean

protected double setSampleMean(double sampleMean)
sets sampleMean

Parameters:
sampleMean - the new mean
Returns:
double sampleMean

setMin

protected double setMin(double min)
sets min

Parameters:
min - the new minimum value
Returns:
double the input

setMax

protected double setMax(double max)
sets max

Parameters:
max - the new maximum value
Returns:
double the input

setN

protected long setN(long n)
sets n

Parameters:
n - the new n
Returns:
double the input

setSum

protected double setSum(double sum)
sets the count

Parameters:
sum - the new sum
Returns:
double the input


Copyright © 2002-2011 Delft University of Technology, the Netherlands. All Rights Reserved.