25package umontreal.ssj.stat.list;
27import cern.colt.matrix.DoubleMatrix2D;
28import umontreal.ssj.stat.Tally;
29import umontreal.ssj.stat.TallyStore;
67 for (
int i = 0; i < size; i++)
81 for (
int i = 0; i < size; i++)
97 for (
int i = 0; i < t; i++)
115 public void add(
double[] x) {
118 throw new IllegalArgumentException(
"Incompatible array length: given " + x.length +
", required " + l);
120 for (
int i = 0; i < l; i++) {
123 if (!Double.isNaN(v) && ta !=
null)
154 final int l = size();
156 for (
int i = 1; i < l; i++) {
170 final int l = size();
171 for (
int i = 0; i < l; i++) {
192 if (size() != v.length)
193 throw new IllegalArgumentException(
"Invalid length of given array");
194 for (
int i = 0; i < v.length; i++) {
195 Tally tally =
get(i);
196 if (tally ==
null || tally.
numberObs() < 2)
215 if (size() != std.length)
216 throw new IllegalArgumentException(
"Invalid length of given array");
217 for (
int i = 0; i < std.length; i++) {
218 Tally tally =
get(i);
219 if (tally ==
null || tally.
numberObs() < 2)
277 Tally tallyi =
get(i);
278 Tally tallyj =
get(j);
279 if (tallyi ==
null || tallyj ==
null)
299 throw new IllegalArgumentException(
"Invalid number of rows in covariance matrix");
300 if (c.columns() != l)
301 throw new IllegalArgumentException(
"Invalid number of columns in covariance matrix");
302 for (
int i1 = 0; i1 < l; i1++)
303 c.setQuick(i1, i1,
get(i1).variance());
304 for (
int i1 = 0; i1 < l - 1; i1++)
305 for (
int i2 = i1 + 1; i2 < l; i2++) {
307 c.setQuick(i1, i2, cov);
308 c.setQuick(i2, i1, cov);
325 throw new IllegalArgumentException(
"Invalid number of rows in correlation matrix");
326 if (c.columns() != l)
327 throw new IllegalArgumentException(
"Invalid number of columns in correlation matrix");
328 for (
int i1 = 0; i1 < l; i1++)
329 c.setQuick(i1, i1, 1.0);
330 for (
int i1 = 0; i1 < l - 1; i1++)
331 for (
int i2 = i1 + 1; i2 < l; i2++) {
333 c.setQuick(i1, i2, cor);
334 c.setQuick(i2, i1, cor);
This class is a variant of Tally for which the individual observations are stored in a list implement...
double covariance(TallyStore t2)
Returns the sample covariance of the observations contained in this tally, and the other tally t2.
double standardDeviation()
Returns the sample standard deviation of the observations since the last initialization.
double average()
Returns the average value of the observations since the last initialization.
int numberObs()
Returns the number of observations given to this probe since its last initialization.
double variance()
Returns the sample variance of the observations since the last initialization.
void add(double x)
Gives a new observation x to the statistical collector.
void notifyListeners(double[] x)
ListOfTallies< E > clone()
Clones this object.
double correlation(int i, int j)
Returns the empirical correlation between the observations in tallies with indices i and j.
void correlation(DoubleMatrix2D c)
Similar to covariance(DoubleMatrix2D) for computing the sample correlation matrix.
boolean areAllNumberObsEqual()
Tests that every tally in this list contains the same number of observations.
static ListOfTallies< Tally > createWithTally(int size)
This factory method constructs and returns a list of tallies with size instances of umontreal....
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 covariance(DoubleMatrix2D c)
Constructs and returns the sample covariance matrix for the tallies in this list.
void standardDeviation(double[] std)
For each tally in this list, computes the sample standard deviation, and stores the standard deviatio...
int numberObs()
Assuming that each tally in this list contains the same number of observations, returns the number of...
static ListOfTallies< TallyStore > createWithTallyStore(int size)
This factory method constructs and returns a list of tallies with size instances of umontreal....
ListOfTallies()
Constructs a new empty list of tallies.
static ListOfTallies< TallyStore > createWithTallyStore(int size, int t)
This factory method constructs and returns a list of tallies with size instances of umontreal....
void add(double[] x)
Adds the observation x[i] in tally i of this list, for i = 0,…, size() - 1.
double covariance(int i, int j)
Returns the empirical covariance of the observations in tallies with indices i and j.
ListOfTallies(String name)
Constructs a new empty list of tallies with name name.
Provides support for lists of statistical probes.