SSJ
V. 1.2.5.

umontreal.iro.lecuyer.stat
Class TallyStore

java.lang.Object
  extended by java.util.Observable
      extended by umontreal.iro.lecuyer.stat.StatProbe
          extended by umontreal.iro.lecuyer.stat.Tally
              extended by umontreal.iro.lecuyer.stat.TallyStore
All Implemented Interfaces:
Cloneable

public class TallyStore
extends Tally

This class is a variant of Tally, but for which the individual observations are stored in a list implemented as a DoubleArrayList. The DoubleArrayList object used to store the values can be either passed to the constructor or created by the constructor, and can be accessed via the getArray method.

The same counters as in Tally are maintained and are used by the inherited methods. To compute quantities not supported by the Tally methods, and/or to use methods provided by the COLT package, one must access the list.

Never add or remove observations directly on the DoubleArrayList object, because this would put the counters of the TallyStore object in an inconsistent state.

There are two potential reasons for using a TallyStore object instead of directly using a DoubleArrayList object: (a) it is an Observable object and (b) it maintains a few additional counters that may speed up some operations such as computing the average.


Constructor Summary
TallyStore()
          Construct a new TallyStore statistical probe.
TallyStore(DoubleArrayList a)
          Construct a new TallyStore statistical probe with given associated array.
TallyStore(int initialCapacity)
          Construct a new TallyStore statistical probe with given initial capacity for its associated array.
 
Method Summary
 void add(double x)
          Gives a new observation x to the statistical collector.
 Object clone()
          Clone this object.
 double covariance(TallyStore t2)
          Returns the sample covariance of the observations contained in this tally, and the other tally t2.
 DoubleArrayList getArray()
          Returns the DoubleArrayList object that contains the observations for this probe.
 void init()
          Initializes the statistical collector.
 
Methods inherited from class umontreal.iro.lecuyer.stat.Tally
average, confidenceIntervalStudent, formatCIStudent, formatCIStudent, formatConfidenceIntervalStudent, formatConfidenceIntervalStudent, numberObs, report, reportAndCIStudent, reportAndCIStudent, reportAndConfidenceIntervalStudent, reportAndConfidenceIntervalStudent, standardDeviation, variance
 
Methods inherited from class umontreal.iro.lecuyer.stat.StatProbe
getName, max, min, setBroadcasting, setCollecting, setName, sum
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TallyStore

public TallyStore()
Construct a new TallyStore statistical probe.


TallyStore

public TallyStore(int initialCapacity)
Construct a new TallyStore statistical probe with given initial capacity for its associated array.

Parameters:
initialCapacity - initial capacity of the array of observations

TallyStore

public TallyStore(DoubleArrayList a)
Construct a new TallyStore statistical probe with given associated array. This array must be empty.

Parameters:
a - array that will contain observations
Method Detail

init

public void init()
Description copied from class: StatProbe
Initializes the statistical collector.

Overrides:
init in class Tally

add

public void add(double x)
Description copied from class: Tally
Gives a new observation x to the statistical collector. If broadcasting to observers is activated for this object, this method will also transmit the new information to the registered observers by invoking the methods setChanged and notifyObservers (new Double (x)) inherited from Observable.

Overrides:
add in class Tally
Parameters:
x - observation being added to this tally

getArray

public DoubleArrayList getArray()
Returns the DoubleArrayList object that contains the observations for this probe.

Returns:
the array of observations associated with this object

covariance

public double covariance(TallyStore t2)
Returns the sample covariance of the observations contained in this tally, and the other tally t2. Both tallies must have the same number of observations.

Parameters:
t2 - the other tally.
Returns:
the sample covariance.

clone

public Object clone()
Clone this object.

Overrides:
clone in class Tally

SSJ
V. 1.2.5.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.