org.jscience.mathematics.analysis.optimization
Class VectorialSampleStatistics

java.lang.Object
  extended by org.jscience.mathematics.analysis.optimization.VectorialSampleStatistics

public class VectorialSampleStatistics
extends java.lang.Object

This class compute basic statistics on a scalar sample.


Constructor Summary
VectorialSampleStatistics()
          Simple constructor.
 
Method Summary
 void add(double[] x)
          Add one point to the instance.
 void add(double[][] points)
          Add all points of an array to the instance.
 void add(VectorialSampleStatistics s)
          Add all the points of another sample to the instance.
 DoubleSymmetricMatrix getCorrelationMatrix(DoubleSymmetricMatrix correlation)
          Deprecated. as of 2004-03-11, replaced by getCovarianceMatrix. This method has in fact always returned a covariance matrix, not a correlation matrix, so the name of the method has been changed.
 DoubleSymmetricMatrix getCovarianceMatrix(DoubleSymmetricMatrix covariance)
          Get the covariance matrix of the underlying law.
 double[] getMax()
          Get the maximal value in the sample.
 int[] getMaxIndices()
          Get the indices at which the maximal value occurred in the sample.
 double[] getMean(double[] mean)
          Get the mean value of the sample.
 double[] getMin()
          Get the minimal value in the sample.
 int[] getMinIndices()
          Get the indices at which the minimal value occurred in the sample.
 int size()
          Get the number of points in the sample.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VectorialSampleStatistics

public VectorialSampleStatistics()
Simple constructor. Build a new empty instance

Method Detail

add

public void add(double[] x)
Add one point to the instance.

Parameters:
x - value of the sample point
Throws:
java.lang.IllegalArgumentException - if there is a dimension mismatch between this point and the ones already added (this cannot happen when the instance is empty)

add

public void add(double[][] points)
Add all points of an array to the instance.

Parameters:
points - array of points
Throws:
java.lang.IllegalArgumentException - if there is a dimension mismatch between these points and the ones already added (this cannot happen when the instance is empty)

add

public void add(VectorialSampleStatistics s)
Add all the points of another sample to the instance.

Parameters:
s - samples to add
Throws:
java.lang.IllegalArgumentException - if there is a dimension mismatch between this sample points and the ones already added (this cannot happen when the instance is empty)

size

public int size()
Get the number of points in the sample.

Returns:
number of points in the sample

getMin

public double[] getMin()
Get the minimal value in the sample.

Since all components of the sample vector can reach their minimal value at different times, this vector should be considered as gathering all minimas of all components. The index of the sample at which the minimum was encountered can be retrieved with the getMinIndices method.

Returns:
minimal value in the sample (the array is a reference to an internal array that changes each time something is added to the instance, the caller should neither change it nor rely on its value in the long term)
See Also:
getMinIndices()

getMinIndices

public int[] getMinIndices()
Get the indices at which the minimal value occurred in the sample.

Returns:
a vector reporting at which occurrence each component of the sample reached its minimal value (the array is a reference to an internal array that changes each time something is added to the instance, the caller should neither change it nor rely on its value in the long term)
See Also:
getMin()

getMax

public double[] getMax()
Get the maximal value in the sample.

Since all components of the sample vector can reach their maximal value at different times, this vector should be considered as gathering all maximas of all components. The index of the sample at which the maximum was encountered can be retrieved with the getMaxIndices method.

Returns:
maximal value in the sample (the array is a reference to an internal array that changes each time something is added to the instance, the caller should neither change it nor rely on its value in the long term)
See Also:
getMaxIndices()

getMaxIndices

public int[] getMaxIndices()
Get the indices at which the maximal value occurred in the sample.

Returns:
a vector reporting at which occurrence each component of the sample reached its maximal value (the array is a reference to an internal array that changes each time something is added to the instance, the caller should neither change it nor rely on its value in the long term)
See Also:
getMax()

getMean

public double[] getMean(double[] mean)
Get the mean value of the sample.

Parameters:
mean - placeholder where to store the array, if null a new array will be allocated
Returns:
mean value of the sample or null if the sample is empty and hence the dimension of the vectors is still unknown (reference to mean if it was non-null, reference to a new array otherwise)

getCorrelationMatrix

public DoubleSymmetricMatrix getCorrelationMatrix(DoubleSymmetricMatrix correlation)
Deprecated. as of 2004-03-11, replaced by getCovarianceMatrix. This method has in fact always returned a covariance matrix, not a correlation matrix, so the name of the method has been changed.

Get the correlation matrix of the underlying law. This method estimate the correlation matrix considering that the data available are only a sample of all possible values. This value is the sample correlation matrix (as opposed to the population correlation matrix).

Parameters:
correlation - placeholder where to store the matrix, if null a new matrix will be allocated
Returns:
correlation matrix of the underlying law

getCovarianceMatrix

public DoubleSymmetricMatrix getCovarianceMatrix(DoubleSymmetricMatrix covariance)
Get the covariance matrix of the underlying law. This method estimate the covariance matrix considering that the data available are only a sample of all possible values. This value is the sample covariance matrix (as opposed to the population covariance matrix).

Parameters:
covariance - placeholder where to store the matrix, if null a new matrix will be allocated
Returns:
correlation matrix of the underlying law