|
NAG[g05qbc] NAG[nag_rngs_corr_matrix] - Computes a random correlation matrix
|
|
Calling Sequence
g05qbc(d, c, igen, iseed, 'n'=n, 'eps'=eps, 'fail'=fail)
nag_rngs_corr_matrix(. . .)
Parameters
|
d - Vector(1..n, datatype=float[8]);
|
|
|
, for ;
|
|
to within eps.
|
|
|
c - Matrix(1..dim1, 1..n, datatype=float[8], order=order);
|
|
|
Note: this array may be supplied in Fortran_order or C_order , as specified by order. All array parameters must use a consistent order.
|
|
On exit: a random correlation matrix, , of dimension .
|
|
|
iseed - Vector(1.. , datatype=integer[kernelopts('wordsize')/8]);
|
|
|
On entry: contains values which define the current state of the selected generator.
|
|
On exit: contains updated values defining the new state of the selected generator.
|
|
|
'n'=n - integer; (optional)
|
|
|
On entry: , the dimension of the correlation matrix to be generated.
|
|
Constraint: . .
|
|
|
'eps'=eps - float; (optional)
|
|
|
On entry: , the maximum acceptable error in the diagonal elements.
|
|
Constraint: (see Chapter x02). .
|
|
Suggested value: . (default: )
|
|
|
'fail'=fail - table; (optional)
|
|
|
The NAG error argument, see the documentation for NagError.
|
|
|
|
Description
|
|
|
Purpose
|
|
nag_rngs_corr_matrix (g05qbc) generates a random correlation matrix with given eigenvalues.
|
|
Error Indicators and Warnings
|
|
"NE_ALLOC_FAIL"
Dynamic memory allocation failed.
"NE_BAD_PARAM"
On entry, argument had an illegal value.
"NE_DIAG_ELEMENTS"
The error in a diagonal element is greater than eps. The value of eps should be increased. Otherwise the program could be rerun with a different value used for the seed of the random number generator, see g05kbc (nag_rngs_init_repeatable) or g05kcc (nag_rngs_init_nonrepeatable).
"NE_EIGVAL_SUM"
On entry, the eigenvalues do not sum to n.
"NE_INT"
On entry, . Constraint: .
"NE_INTERNAL_ERROR"
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please consult NAG for assistance.
"NE_NEGATIVE_EIGVAL"
On entry, an eigenvalue is negative.
"NE_REAL"
On entry, : .
|
|
Accuracy
|
|
The maximum error in a diagonal element is given by eps.
|
|
Further Comments
|
|
The time taken by nag_rngs_corr_matrix (g05qbc) is approximately proportional to .
|
|
|
Examples
|
|
>
|
n := 3:
eps := 0.0001:
igen := 1:
d := Vector([0.7, 0.9, 1.4], datatype=float[8]):
c := Matrix(3, 3, datatype=float[8]):
iseed := Vector([1762543, 9324783, 423446, 742355], datatype=integer[kernelopts('wordsize')/8]):
NAG:-g05qbc(d, c, igen, iseed, 'n' = n, 'eps' = eps):
|
|
|