nag_nearest_correlation_shrinking (g02anc) computes a correlation matrix, subject to preserving a leading principle submatrix and applying the smallest uniform perturbation to the remainder of the approximate input matrix.
nag_nearest_correlation_shrinking (g02anc) finds a correlation matrix,
, starting from an approximate correlation matrix,
, with positive definite leading principle submatrix of order
. The returned correlation matrix,
, has the following structure:
where
is the
by
leading principle submatrix of the input matrix
and positive definite, and
.
nag_nearest_correlation_shrinking (g02anc) utilizes a shrinking method to find the minimum value of such that is positive definite with unit diagonal.
Higham N J, Strabić N and Šego V (2014) Restoring definiteness via shrinking, with an application to correlation matrices with a fixed block MIMS EPrint 2014.54 Manchester Institute for Mathematical Sciences, The University of Manchester, UK
- 1:
– doubleInput/Output
-
Note: the th element of the matrix is stored in .
On entry: , the initial matrix.
On exit: a symmetric matrix with the diagonal set to .
- 2:
– IntegerInput
-
On entry: the stride separating matrix row elements in the array
g.
Constraint:
.
- 3:
– IntegerInput
-
On entry: the order of the matrix .
Constraint:
.
- 4:
– IntegerInput
-
On entry: , the order of the leading principle submatrix .
Constraint:
.
- 5:
– doubleInput
-
On entry: the termination tolerance for the iteration.
If
,
is used. See
Section 7 for further details.
- 6:
– doubleInput
-
On entry: the tolerance used in determining the definiteness of
.
If , where and denote the minimum and maximum eigenvalues of respectively, is positive definite.
If , machine precision is used.
- 7:
– doubleOutput
-
Note: the th element of the matrix is stored in .
On exit: contains the matrix .
- 8:
– IntegerInput
-
On entry: the stride separating matrix row elements in the array
x.
Constraint:
.
- 9:
– double *Output
-
On exit: .
- 10:
– Integer *Output
-
On exit: the number of iterations taken.
- 11:
– double *Output
-
On exit: the smallest eigenvalue of the leading principle submatrix .
- 12:
– double *Output
-
On exit: the value of after the final iteration.
- 13:
– NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
The algorithm uses a bisection method. It is terminated when the computed
is within
errtol of the minimum value. The positive definiteness of
is such that it can be sucessfully factorized with a call to
nag_dpotrf (f07fdc).
The number of interations taken for the bisection will be:
nag_nearest_correlation_shrinking (g02anc) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
nag_nearest_correlation_shrinking (g02anc) 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.
Arrays are internally allocated by nag_nearest_correlation_shrinking (g02anc). The total size of these arrays does not exceed real elements. All allocated memory is freed before return of nag_nearest_correlation_shrinking (g02anc).
This example finds the smallest uniform perturbation
to
, such that the output is a correlation matrix and the
-by-
leading principle submatrix of the input is preserved,