Generates a series of random variables with the specified correlation matrix.
Extreme.Numerics.Net40 (in Extreme.Numerics.Net40.dll) Version: 6.0.16073.0 (6.0.17114.0)
public static Vector<double> CorrelatedSamples(
this Random random,
Public Shared Function CorrelatedSamples (
random As Random,
numberOfSamples As Integer,
distributions As Distribution(),
correlations As SymmetricMatrix(Of Double)
) As Vector(Of Double)()
static array<Vector<double>^>^ CorrelatedSamples(
static member CorrelatedSamples :
random : Random *
numberOfSamples : int *
distributions : Distribution *
correlations : SymmetricMatrix<float> -> Vector<float>
- Type: SystemRandom
A random number generator used to generate
samples from the distributions.
- Type: SystemInt32
The number of
- Type: Extreme.Statistics.DistributionsDistribution
An array of Distribution objects that specifies the probability
distribution of each variable.
- Type: Extreme.Mathematics.LinearAlgebraSymmetricMatrixDouble
A SymmetricMatrixT that specifies the desired correlation matrix.
An array of real vectors with approximately the specified correlation matrix.
In Visual Basic and C#, you can call this method as an instance method on any object of type Random
. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic)
or Extension Methods (C# Programming Guide)
Use this method to generate a series of correlated numerical variables. Each variable is composed of random samples
taken from the corresponding distribution in the distributions array. Both continuous and discrete
distributions are allowed. correlations must be a correlation matrix. It must be positive definite with
ones on the diagonal. The size of the correlation matrix must match the length of distributions.
The number of samples must be at least two.
The correlation matrix of the variables will be approximately equal to correlations.
Larger sample sizes will generally yield a better approximation, especially if the probability distributions are fairly symmetrical.
For very asymmetrical distributions, it may be difficult to produce the desired correlation.
This method uses the algorithm of Iman-Conover.
Supported in: 6.0