Creates two sequences of correlated random numbers using the specified random number generators. The created sequence's Spearman rank correlation will be approximately equal to the specified number.

Namespace:  CenterSpace.NMath.Stats
Assembly:  NMathStats (in NMathStats.dll) Version: 3.4.0.0

Syntax

C#
public static DoubleMatrix CorrelatedRandomInputs(
	int numSamples,
	double desiredCorrelation,
	RandomNumberGenerator xInputs,
	RandomNumberGenerator yInputs
)
Visual Basic (Declaration)
Public Shared Function CorrelatedRandomInputs ( _
	numSamples As Integer, _
	desiredCorrelation As Double, _
	xInputs As RandomNumberGenerator, _
	yInputs As RandomNumberGenerator _
) As DoubleMatrix
Visual C++
public:
static DoubleMatrix^ CorrelatedRandomInputs(
	int numSamples, 
	double desiredCorrelation, 
	RandomNumberGenerator^ xInputs, 
	RandomNumberGenerator^ yInputs
)

Parameters

numSamples
Type: System..::.Int32
The number of correlated random numbers to createn
desiredCorrelation
Type: System..::.Double
The desired Spearman rank correlation for the the two sequnces. Must be between -1 and 1, inclusive.
xInputs
Type: CenterSpace.NMath.Core..::.RandomNumberGenerator
Random number generator for one of the sequences.
yInputs
Type: CenterSpace.NMath.Core..::.RandomNumberGenerator
Random number generator for the other sequence.

Return Value

Matrix whose columns are the two sequences of correlated random numbers.

Exceptions

ExceptionCondition
CenterSpace.NMath.Core..::.InvalidArgumentExceptionThrown if desired rank correlation is not between -1 and 1.

See Also