|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.measure.random.CorrelatedRandomVectorGenerator
public class CorrelatedRandomVectorGenerator
This class allows to generate random vectors with correlated components.
Random vectors with correlated components are built by combining the uncorrelated components of another random vector in such a way the resulting correlations are the ones specified by a positive definite covariance matrix.
Sometimes, the covariance matrix for a given simulation is not
strictly positive definite. This means that the correlations are
not all independant from each other. In this case, however, the non
strictly positive elements found during the Cholesky decomposition
of the covariance matrix should not be negative either, they
should be null. This implies that rather than computing C =
L.Lt where C is the covariance matrix and
L is a lower-triangular matrix, we compute C =
B.Bt where B is a rectangular matrix having
more rows than columns. The number of columns of B is
the rank of the covariance matrix, and it is the dimension of the
uncorrelated random vector that is needed to compute the component
of the correlated vector. This class does handle this situation
automatically.
| Constructor Summary | |
|---|---|
CorrelatedRandomVectorGenerator(double[] mean,
DoubleSymmetricMatrix covariance,
RandomGenerator generator)
Simple constructor. |
|
CorrelatedRandomVectorGenerator(DoubleSymmetricMatrix covariance,
RandomGenerator generator)
Simple constructor. |
|
| Method Summary | |
|---|---|
RandomGenerator |
getGenerator()
Get the underlying normalized components generator. |
int |
getRank()
Get the rank of the covariance matrix. |
Matrix |
getRootMatrix()
Get the root of the covariance matrix. |
double[] |
nextVector()
Generate a correlated random vector. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CorrelatedRandomVectorGenerator(double[] mean,
DoubleSymmetricMatrix covariance,
RandomGenerator generator)
throws NotPositiveDefiniteMatrixException
Build a correlated random vector generator from its mean vector and covariance matrix.
mean - expected mean values for all componentscovariance - covariance matrixgenerator - underlying generator for uncorrelated normalized
components
java.lang.IllegalArgumentException - if there is a dimension
mismatch between the mean vector and the covariance matrix
NotPositiveDefiniteMatrixException - if the
covariance matrix is not strictly positive definite
public CorrelatedRandomVectorGenerator(DoubleSymmetricMatrix covariance,
RandomGenerator generator)
throws NotPositiveDefiniteMatrixException
Build a null mean random correlated vector generator from its covariance matrix.
covariance - covariance matrixgenerator - underlying generator for uncorrelated normalized
components
NotPositiveDefiniteMatrixException - if the
covariance matrix is not strictly positive definite| Method Detail |
|---|
public Matrix getRootMatrix()
B such that B.Bt
is equal to the covariance matrix
public RandomGenerator getGenerator()
public int getRank()
public double[] nextVector()
nextVector in interface RandomVectorGenerator
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||