The function may be called by the names: g05pyc, nag_rand_matrix_corr or nag_rand_corr_matrix.
, such that
g05pyc will generate a random correlation matrix,
, of dimension , with eigenvalues .
The method used is based on that described by
Lin and Bendel (1985). Let be the diagonal matrix with values and let be a random orthogonal matrix generated by
g05pxc then the matrix is a random covariance matrix with eigenvalues . The matrix is transformed into a correlation matrix by means of elementary rotation matrices such that . The restriction on the sum of eigenvalues implies that for any diagonal element of , there is another diagonal element . The are constructed from such pairs, chosen at random, to produce a unit diagonal element corresponding to the first element. This is repeated until all diagonal elements are to within a given tolerance .
The randomness of should be interpreted only to the extent that is a random orthogonal matrix and is computed from using the which are chosen as arbitrarily as possible.
One of the initialization functions g05kfc (for a repeatable sequence if computed sequentially) or g05kgc (for a non-repeatable sequence) must be called prior to the first call to g05pyc.
Lin S P and Bendel R B (1985) Algorithm AS 213: Generation of population correlation on matrices with specified eigenvalues Appl. Statist.34 193–198
1: – IntegerInput
On entry: , the dimension of the correlation matrix to be generated.
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
On entry, state vector has been corrupted or not initialized.
On entry, an eigenvalue is negative.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
On entry, .
The maximum error in a diagonal element is given by
8Parallelism and Performance
g05pyc is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g05pyc makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
The time taken by g05pyc is approximately proportional to .
Following initialization of the pseudorandom number generator by a call to
g05kfc, a correlation matrix with eigenvalues of , and is generated and printed.