public class ListOfTallies<E extends Tally> extends ListOfStatProbes<E>
| Constructor and Description |
|---|
ListOfTallies()
Constructs a new empty list of tallies.
|
ListOfTallies(java.lang.String name)
Constructs a new empty list of tallies with name name.
|
| Modifier and Type | Method and Description |
|---|---|
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(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(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.
|
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, toArraypublic ListOfTallies()
public ListOfTallies(java.lang.String name)
name - the name of the new list.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.java.lang.NullPointerException - if x is null.java.lang.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.java.lang.NullPointerException - if v is null.java.lang.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.java.lang.NullPointerException - if std is null.java.lang.IllegalArgumentException - if std.length
does not correspond to size().public double covariance(int i,
int j)
∑k=1n(xk - bar(X)n)(yk - bar(Y)n) = [tex2html_wrap_indisplay275](∑k=1nxkyk -
∑k=1nxk∑r=1nyr).
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.java.lang.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.java.lang.ArrayIndexOutOfBoundsException - if one or both
indices are out of bounds.public void covariance(DoubleMatrix2D c)
c - the matrix to be filled with the sample covariances.java.lang.NullPointerException - if c is null.java.lang.IllegalArgumentException - if the number of rows or columns
in c does not correspond to size().public void correlation(DoubleMatrix2D c)
covariance for computing
the sample correlation matrix.c - the matrix to be filled with the correlations.java.lang.NullPointerException - if c is null.java.lang.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>To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.