G05PYF generates a random correlation matrix with given eigenvalues.
Given
eigenvalues,
, such that
and
G05PYF 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
G05PXF 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
.
One of the initialization routines
G05KFF (for a repeatable sequence if computed sequentially) or
G05KGF (for a non-repeatable sequence) must be called prior to the first call to G05PYF.
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
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
The maximum error in a diagonal element is given by
EPS.
G05PYF is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
G05PYF 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 routine. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
Following initialization of the pseudorandom number generator by a call to
G05KFF, a
by
correlation matrix with eigenvalues of
,
and
is generated and printed.