G05PYF generates a random correlation matrix with given eigenvalues.
Given
n eigenvalues,
λ1,λ2,…,λn, such that
and
G05PYF will generate a random correlation matrix,
C, of dimension
n, with eigenvalues
λ1,λ2,…,λn.
The method used is based on that described by
Lin and Bendel (1985). Let
D be the diagonal matrix with values
λ1,λ2,…,λn and let
A be a random orthogonal matrix generated by
G05PXF then the matrix
C0=A
D
AT is a random covariance matrix with eigenvalues
λ1,λ2,…,λn. The matrix
C0 is transformed into a correlation matrix by means of
n-1 elementary rotation matrices
Pi such that
C
=
Pn-1
Pn-2
…
P1
C0
P1T
…
Pn-2T
Pn-1T
. The restriction on the sum of eigenvalues implies that for any diagonal element of
C0>1, there is another diagonal element
<1. The
Pi 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
1 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
IFAIL=0 or
-1, 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.
Following initialization of the pseudorandom number generator by a call to
G05KFF, a
3 by
3 correlation matrix with eigenvalues of
0.7,
0.9 and
1.4 is generated and printed.