umontreal.iro.lecuyer.stat
Class TallyStore
- java.lang.Object
-
- umontreal.iro.lecuyer.stat.StatProbe
-
- umontreal.iro.lecuyer.stat.Tally
-
- umontreal.iro.lecuyer.stat.TallyStore
-
- All Implemented Interfaces:
- java.lang.Cloneable
public class TallyStore extends Tally
This class is a variant ofTallyfor which the individual observations are stored in a list implemented as aDoubleArrayList. TheDoubleArrayListobject used to store the values can be either passed to the constructor or created by the constructor, and can be accessed via thegetDoubleArrayListmethod.The same counters as in
Tallyare maintained and are used by the inherited methods. One must access the list of observations to compute quantities not supported by the methods inTally, and/or to use methods provided by the COLT package.Never add or remove observations directly on the
DoubleArrayListobject, because this would put the counters of the TallyStore object in an inconsistent state.There are two potential reasons for using a
TallyStoreobject instead of directly using aDoubleArrayListobject: (a) it can broadcast observations and (b) it maintains a few additional counters that may speed up some operations such as computing the average.
-
-
Constructor Summary
Constructors Constructor and Description TallyStore()Constructs a new TallyStore statistical probe.TallyStore(DoubleArrayList a)Constructs a new TallyStore statistical probe with given associated array.TallyStore(int capacity)Constructs a new TallyStore statistical probe with given initial capacity capacity for its associated array.TallyStore(java.lang.String name)Constructs a new TallyStore statistical probe with name name.TallyStore(java.lang.String name, int capacity)Constructs a new TallyStore statistical probe with name name and given initial capacity capacity for its associated array.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(double x)Gives a new observation x to the statistical collector.TallyStoreclone()Clones this object and the array which stores the observations.doublecovariance(TallyStore t2)Returns the sample covariance of the observations contained in this tally, and the other tally t2.double[]getArray()Returns the observations stored in this probe.DoubleArrayListgetDoubleArrayList()Returns theDoubleArrayListobject that contains the observations for this probe.voidinit()Initializes the statistical collector.voidquickSort()Sorts the elements of this probe using the quicksort from Colt.java.lang.StringtoString()Returns the observations stored in this object as a String.-
Methods inherited from class umontreal.iro.lecuyer.stat.Tally
average, confidenceIntervalNormal, confidenceIntervalStudent, confidenceIntervalVarianceChi2, formatCINormal, formatCINormal, formatCIStudent, formatCIStudent, formatCIVarianceChi2, formatConfidenceIntervalNormal, formatConfidenceIntervalNormal, formatConfidenceIntervalStudent, formatConfidenceIntervalStudent, getConfidenceLevel, numberObs, report, report, reportAndCIStudent, reportAndCIStudent, reportAndConfidenceIntervalStudent, reportAndConfidenceIntervalStudent, setConfidenceIntervalNone, setConfidenceIntervalNormal, setConfidenceIntervalStudent, setConfidenceLevel, setShowNumberObs, shortReport, shortReportHeader, standardDeviation, variance
-
Methods inherited from class umontreal.iro.lecuyer.stat.StatProbe
addObservationListener, clearObservationListeners, getName, isBroadcasting, isCollecting, max, min, notifyListeners, removeObservationListener, report, report, setBroadcasting, setCollecting, setName, sum
-
-
-
-
Constructor Detail
-
TallyStore
public TallyStore()
Constructs a new TallyStore statistical probe.
-
TallyStore
public TallyStore(java.lang.String name)
Constructs a new TallyStore statistical probe with name name.- Parameters:
name- the name of the tally.
-
TallyStore
public TallyStore(int capacity)
Constructs a new TallyStore statistical probe with given initial capacity capacity for its associated array.- Parameters:
capacity- initial capacity of the array of observations
-
TallyStore
public TallyStore(java.lang.String name, int capacity)Constructs a new TallyStore statistical probe with name name and given initial capacity capacity for its associated array.- Parameters:
name- the name of the tally.capacity- initial capacity of the array of observations
-
TallyStore
public TallyStore(DoubleArrayList a)
Constructs 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:StatProbeInitializes the statistical collector.
-
add
public void add(double x)
Description copied from class:TallyGives a new observation x to the statistical collector. If broadcasting to observers is activated for this object, this method also transmits the new information to the registered observers by invoking the methodnotifyListeners.
-
getArray
public double[] getArray()
Returns the observations stored in this probe.- Returns:
- the array of observations associated with this object
-
getDoubleArrayList
public DoubleArrayList getDoubleArrayList()
Returns theDoubleArrayListobject that contains the observations for this probe. WARNING: In previous releases, this function was named getArray.- Returns:
- the array of observations associated with this object
-
quickSort
public void quickSort()
Sorts the elements of this probe using the quicksort from Colt.
-
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. This returns Double.NaN if the tallies do not contain the same number of observations, or if they contain less than two observations.- Parameters:
t2- the other tally.- Returns:
- the sample covariance.
-
clone
public TallyStore clone()
Clones this object and the array which stores the observations.
-
toString
public java.lang.String toString()
Returns the observations stored in this object as a String.- Overrides:
toStringin classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG