org.spaceroots.mantissa.random
Class VectorialSampleStatistics
- java.lang.Object
-
- org.spaceroots.mantissa.random.VectorialSampleStatistics
-
public class VectorialSampleStatistics extends java.lang.ObjectThis class compute basic statistics on a scalar sample.
-
-
Constructor Summary
Constructors Constructor and Description VectorialSampleStatistics()Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(double[] x)Add one point to the instance.voidadd(double[][] points)Add all points of an array to the instance.voidadd(VectorialSampleStatistics s)Add all the points of another sample to the instance.SymetricalMatrixgetCovarianceMatrix(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.intsize()Get the number of points in the sample.
-
-
-
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
getMinIndicesmethod.- 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
getMaxIndicesmethod.- 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)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG