Represents a list of tally statistical collectors. More...
Public Member Functions | |
| ListOfTallies () | |
| Constructs a new empty list of tallies. | |
| ListOfTallies (String name) | |
| Constructs a new empty list of tallies with name name. | |
| void | add (double[] x) |
| Adds the observation x[i] in tally i of this list, for i =
0,…, size() - 1. | |
| 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. | |
| 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. | |
| void | variance (double[] v) |
| For each tally in this list, computes the sample variance, and stores the variances into the array v. | |
| void | standardDeviation (double[] std) |
| For each tally in this list, computes the sample standard deviation, and stores the standard deviations into the array std. | |
| double | covariance (int i, int j) |
| Returns the empirical covariance of the observations in tallies with indices i and j. | |
| 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. | |
| void | correlation (DoubleMatrix2D c) |
| Similar to covariance(DoubleMatrix2D) for computing the sample correlation matrix. | |
| ListOfTallies< E > | clone () |
| Clones this object. | |
| Public Member Functions inherited from umontreal.ssj.stat.list.ListOfStatProbes< E > | |
| ListOfStatProbes () | |
| Constructs an empty list of statistical probes. | |
| String | getName () |
| Returns the global name of this list of statistical probes. | |
| void | setName (String name) |
| Sets the global name of this list to name. | |
| boolean | isModifiable () |
| Determines if this list of statistical probes is modifiable, i.e., if probes can be added or removed. | |
| void | setUnmodifiable () |
| Forbids any future modification to this list of statistical probes. | |
| void | init () |
| Initializes this list of statistical probes by calling umontreal.ssj.stat.StatProbe.init on each element. | |
| void | sum (double[] s) |
| For each probe in the list, computes the sum by calling umontreal.ssj.stat.StatProbe.sum, and stores the results into the array s. | |
| void | average (double[] a) |
| For each probe in this list, computes the average by calling umontreal.ssj.stat.StatProbe.average, and stores the results into the array a. | |
| boolean | isCollecting () |
| Determines if this list of statistical probes is collecting values. | |
| void | setCollecting (boolean c) |
| Sets the status of the statistical collecting mechanism to c. | |
| boolean | isBroadcasting () |
| Determines if this list of statistical probes is broadcasting observations to registered observers. | |
| void | setBroadcasting (boolean b) |
| Sets the status of the observation broadcasting mechanism to b. | |
| void | addArrayOfObservationListener (ArrayOfObservationListener l) |
| Adds the observation listener l to the list of observers of this list of statistical probes. | |
| void | removeArrayOfObservationListener (ArrayOfObservationListener l) |
| Removes the observation listener l from the list of observers of this list of statistical probes. | |
| void | clearArrayOfObservationListeners () |
| Removes all observation listeners from the list of observers of this list of statistical probes. | |
| void | notifyListeners (double[] x) |
| Notifies the observation x to all registered observers if broadcasting is ON. | |
| String | report () |
| Formats a report for each probe in the list of statistical probes. | |
| ListOfStatProbes< E > | clone () |
| Clones this object. | |
Static Public Member Functions | |
| static ListOfTallies< Tally > | createWithTally (int size) |
| This factory method constructs and returns a list of tallies with size instances of umontreal.ssj.stat.Tally. | |
| static ListOfTallies< TallyStore > | createWithTallyStore (int size) |
| This factory method constructs and returns a list of tallies with size instances of umontreal.ssj.stat.TallyStore. | |
| static ListOfTallies< TallyStore > | createWithTallyStore (int size, int t) |
| This factory method constructs and returns a list of tallies with size instances of umontreal.ssj.stat.TallyStore, each of size \(t\). | |
Represents a list of tally statistical collectors.
Each element of the list is an instance of umontreal.ssj.stat.Tally, and a vector of observations can be added with the add(double[]) method. This class defines factory methods to fill a newly-constructed list with Tally or TallyStore instances.
Definition at line 40 of file ListOfTallies.java.
| umontreal.ssj.stat.list.ListOfTallies< E extends Tally >.ListOfTallies | ( | ) |
Constructs a new empty list of tallies.
Definition at line 45 of file ListOfTallies.java.
| umontreal.ssj.stat.list.ListOfTallies< E extends Tally >.ListOfTallies | ( | String | name | ) |
Constructs a new empty list of tallies with name name.
| name | the name of the new list. |
Definition at line 54 of file ListOfTallies.java.
| void umontreal.ssj.stat.list.ListOfTallies< E extends Tally >.add | ( | double[] | x | ) |
Adds the observation x[i] in tally i of this list, for i = 0,…, size() - 1.
No observation is added if the value is Double.NaN, or if collecting is turned OFF. If broadcasting is ON, the given array is notified to all registered observers. The given array x not being stored by this object, it can be freely used and modified after the call to this method.
| x | the array of observations. |
| NullPointerException | if `x` is `null`. |
| IllegalArgumentException | if the length of `x` does not correspond to size(). |
Reimplemented in umontreal.ssj.mcqmctools.anova.AnovaVarianceCollector.
Definition at line 115 of file ListOfTallies.java.
| boolean umontreal.ssj.stat.list.ListOfTallies< E extends Tally >.areAllNumberObsEqual | ( | ) |
Tests that every tally in this list contains the same number of observations.
This returns true if and only if all tallies have the same number of observations, or if this list is empty. If observations are always added using the add(double[]) method from this class, and not umontreal.ssj.stat.Tally.add(double) from
umontreal.ssj.stat.Tally, this method always returns true.
Definition at line 153 of file ListOfTallies.java.
| void umontreal.ssj.stat.list.ListOfTallies< E extends Tally >.average | ( | double[] | r | ) |
Computes the average for each tally in this list, and stores the averages in the array r.
If the tally i has no observation, the Double.NaN value is stored in the array, at index i.
Definition at line 169 of file ListOfTallies.java.
| ListOfTallies< E > umontreal.ssj.stat.list.ListOfTallies< E extends Tally >.clone | ( | ) |
Clones this object.
This makes a shallow copy of this list, i.e., this does not clone all the tallies in the list. The created clone is modifiable, even if the original list is unmodifiable.
Definition at line 343 of file ListOfTallies.java.
| void umontreal.ssj.stat.list.ListOfTallies< E extends Tally >.correlation | ( | DoubleMatrix2D | c | ) |
Similar to covariance(DoubleMatrix2D) 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 umontreal.ssj.stat.list.ListOfStatProbes.size. |
Definition at line 322 of file ListOfTallies.java.
| double umontreal.ssj.stat.list.ListOfTallies< E extends Tally >.correlation | ( | int | i, |
| int | j ) |
Returns the empirical correlation between the observations in tallies with indices i and j.
If the tally i contains a sample of the random variate \(X\) and the tally j contains a sample of
\(Y\), this corresponds to
\[ \mathrm{Cor}(X, Y)=\mathrm{Cov}(X, Y) /\sqrt{\mathrm{Var}(X)\mathrm{Var}(Y)}. \]
This method uses covariance(int,int) to obtain an estimate of the covariance, and umontreal.ssj.stat.Tally.variance in class umontreal.ssj.stat.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. |
Definition at line 273 of file ListOfTallies.java.
| void umontreal.ssj.stat.list.ListOfTallies< E extends Tally >.covariance | ( | DoubleMatrix2D | c | ) |
Constructs and returns the sample covariance matrix for the tallies in this list.
The given \(d\times d\) matrix c, where
\(d=\) size(), is filled with the computed sample covariances. Element c.get (i, j) corresponds to the result of covariance (i, j).
| 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(). |
Definition at line 296 of file ListOfTallies.java.
| double umontreal.ssj.stat.list.ListOfTallies< E extends Tally >.covariance | ( | int | i, |
| int | j ) |
Returns the empirical covariance of the observations in tallies with indices i and j.
If \(x_1,…,x_n\) represent the observations in tally i whereas \(y_1,…,y_n\) represent the observations in tally j, then the covariance is given by
\[ S_{X, Y} = \frac{1}{n-1}\sum_{k=1}^n (x_k - \bar{X}_n)(y_k - \bar{Y}_n) = \frac{1}{n-1}\left(\sum_{k=1}^n x_ky_k - \frac{1}{n} \sum_{k=1}^n x_k\sum_{r=1}^n y_r\right). \]
This returns Double.NaN if the tallies do not contain the same number of observations, or if they contain less than two observations. This method throws an exception if the underlying tallies are not capable of storing observations, i.e. if the tallies are not TallyStores. The 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. |
Definition at line 247 of file ListOfTallies.java.
|
static |
This factory method constructs and returns a list of tallies with size instances of umontreal.ssj.stat.Tally.
| size | the size of the list. |
Definition at line 65 of file ListOfTallies.java.
|
static |
This factory method constructs and returns a list of tallies with size instances of umontreal.ssj.stat.TallyStore.
| size | the size of the list. |
Definition at line 79 of file ListOfTallies.java.
|
static |
This factory method constructs and returns a list of tallies with size instances of umontreal.ssj.stat.TallyStore, each of size \(t\).
| size | the size of the list. |
| t | size of each TallyStore in this list. |
Definition at line 95 of file ListOfTallies.java.
| int umontreal.ssj.stat.list.ListOfTallies< E extends Tally >.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.
Definition at line 136 of file ListOfTallies.java.
| void umontreal.ssj.stat.list.ListOfTallies< E extends Tally >.standardDeviation | ( | double[] | std | ) |
For each tally in this list, computes the sample standard deviation, and stores the standard deviations into the array std.
This is equivalent to calling variance(double[]) 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(). |
Definition at line 214 of file ListOfTallies.java.
| void umontreal.ssj.stat.list.ListOfTallies< E extends Tally >.variance | ( | double[] | v | ) |
For each tally in this list, computes the sample variance, and stores the variances into the array v.
If, for some tally i, there are not enough observations for estimating the variance, Double.NaN is stored in the array.
| v | the array to be filled with sample variances. |
| NullPointerException | if `v` is `null`. |
| IllegalArgumentException | if `v.length` does not correspond to umontreal.ssj.stat.list.ListOfStatProbes.size. |
Definition at line 191 of file ListOfTallies.java.