org.spaceroots.mantissa.random
Class VectorialSampleStatistics

java.lang.Object
  extended byorg.spaceroots.mantissa.random.VectorialSampleStatistics

public class VectorialSampleStatistics
extends Object

This class compute basic statistics on a scalar sample.

Version:
$Id: VectorialSampleStatistics.java 1709 2006-12-03 21:16:50Z luc $
Author:
L. Maisonobe

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.
 SymetricalMatrix getCovarianceMatrix(SymetricalMatrix 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()
          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:
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:
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:
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 (a new array is created at each call, the caller may do what it wants to with it)
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 (a new array is created at each call, the caller may do what it wants to with it)
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 (a new array is created at each call, the caller may do what it wants to with it)
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 (a new array is created at each call, the caller may do what it wants to with it)
See Also:
getMax()

getMean

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

Returns:
mean value of the sample or an empty array if the sample is empty (a new array is created at each call, the caller may do what it wants to with it)

getCovarianceMatrix

public SymetricalMatrix getCovarianceMatrix(SymetricalMatrix 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:
covariance matrix of the underlying or null if the sample has less than 2 points (reference to covariance if it was non-null, reference to a new matrix otherwise)


Copyright © 2001-2007 Luc Maisonobe. All Rights Reserved.