|
SSJ V. 2.6. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object umontreal.iro.lecuyer.stat.list.ListOfStatProbes<E> umontreal.iro.lecuyer.stat.list.ListOfTallies<E>
public class ListOfTallies<E extends Tally>
Represents a list of tally statistical collectors.
Each element of the list is an instance of Tally
,
and a vector of observations can be added with
the add
method.
This class defines factory methods to fill a newly-constructed list
with Tally or TallyStore instances.
Constructor Summary | |
---|---|
ListOfTallies()
Constructs a new empty list of tallies. |
|
ListOfTallies(String name)
Constructs a new empty list of tallies with name name. |
Method Summary | |
---|---|
void |
add(double[] x)
Adds the observation x[i] in tally i of this list, for i = 0,..., size() - 1. |
boolean |
areAllNumberObsEqual()
Tests that every tally in this list contains the same number of observations. |
void |
average(double[] r)
Computes the average for each tally in this list, and stores the averages in the array r. |
ListOfTallies<E> |
clone()
Clones this object. |
void |
correlation(cern.colt.matrix.DoubleMatrix2D c)
Similar to covariance for computing
the sample correlation matrix. |
double |
correlation(int i,
int j)
Returns the empirical correlation between the observations in tallies with indices i and j. |
void |
covariance(cern.colt.matrix.DoubleMatrix2D c)
Constructs and returns the sample covariance matrix for the tallies in this list. |
double |
covariance(int i,
int j)
Returns the empirical covariance of the observations in tallies with indices i and j. |
static ListOfTallies<Tally> |
createWithTally(int size)
This factory method constructs and returns a list of tallies with size instances of Tally . |
static ListOfTallies<TallyStore> |
createWithTallyStore(int size)
This factory method constructs and returns a list of tallies with size instances of TallyStore . |
int |
numberObs()
Assuming that each tally in this list contains the same number of observations, returns the number of observations in tally 0, or 0 if this list is empty. |
void |
standardDeviation(double[] std)
For each tally in this list, computes the sample standard deviation, and stores the standard deviations into the array std. |
void |
variance(double[] v)
For each tally in this list, computes the sample variance, and stores the variances into the array v. |
Methods inherited from class umontreal.iro.lecuyer.stat.list.ListOfStatProbes |
---|
add, add, addAll, addAll, addArrayOfObservationListener, clear, clearArrayOfObservationListeners, contains, containsAll, equals, get, getName, hashCode, indexOf, init, isBroadcasting, isCollecting, isEmpty, isModifiable, iterator, lastIndexOf, listIterator, listIterator, notifyListeners, remove, remove, removeAll, removeArrayOfObservationListener, report, retainAll, set, setBroadcasting, setCollecting, setName, setUnmodifiable, size, subList, sum, toArray, toArray |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ListOfTallies()
public ListOfTallies(String name)
name
- the name of the new list.Method Detail |
---|
public static ListOfTallies<Tally> createWithTally(int size)
Tally
.
size
- the size of the list.
public static ListOfTallies<TallyStore> createWithTallyStore(int size)
TallyStore
.
size
- the size of the list.
public void add(double[] x)
x
- the array of observations.
NullPointerException
- if x is null.
IllegalArgumentException
- if the length of
x does not correspond to size().public int numberObs()
public boolean areAllNumberObsEqual()
add
method from this class, and not
add
from
Tally
, this method always returns true.
public void average(double[] r)
average
in class ListOfStatProbes<E extends Tally>
r
- the array to be filled with averages.public void variance(double[] v)
v
- the array to be filled with sample variances.
NullPointerException
- if v is null.
IllegalArgumentException
- if v.length
does not correspond to size
.public void standardDeviation(double[] std)
variance
and
performing a square root on every element
of the filled array.
std
- the array to be filled with standard deviations.
NullPointerException
- if std is null.
IllegalArgumentException
- if std.length
does not correspond to size().public double covariance(int i, int j)
ListOfTalliesWithCovariance
subclass provides an alternative implementation
of this method which does not require the
observations to be stored.
i
- the index of the first tally.j
- the index of the second tally.
ArrayIndexOutOfBoundsException
- if one or both
indices are out of bounds.public double correlation(int i, int j)
This method uses covariance
to obtain an estimate of the covariance, and
variance
in
class Tally
to obtain the sample variances.
i
- the index of the first tally.j
- the index of the second tally.
ArrayIndexOutOfBoundsException
- if one or both
indices are out of bounds.public void covariance(cern.colt.matrix.DoubleMatrix2D c)
c
- the matrix to be filled with the sample covariances.
NullPointerException
- if c is null.
IllegalArgumentException
- if the number of rows or columns
in c does not correspond to size().public void correlation(cern.colt.matrix.DoubleMatrix2D c)
covariance
for computing
the sample correlation matrix.
c
- the matrix to be filled with the correlations.
NullPointerException
- if c is null.
IllegalArgumentException
- if the number of rows or columns in c
does not correspond to size
.public ListOfTallies<E> clone()
clone
in class ListOfStatProbes<E extends Tally>
|
SSJ V. 2.6. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |