PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_nearest_correlation_shrinking (g02an)
Purpose
nag_nearest_correlation_shrinking (g02an) 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.
Syntax
[
g,
x,
alpha,
iter,
eigmin,
norm_p,
ifail] = g02an(
g,
k, 'n',
n, 'errtol',
errtol, 'eigtol',
eigtol)
[
g,
x,
alpha,
iter,
eigmin,
norm_p,
ifail] = nag_nearest_correlation_shrinking(
g,
k, 'n',
n, 'errtol',
errtol, 'eigtol',
eigtol)
Description
nag_nearest_correlation_shrinking (g02an) 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 (g02an) utilizes a shrinking method to find the minimum value of such that is positive definite with unit diagonal.
References
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
Parameters
Compulsory Input Parameters
- 1:
– double array
-
ldg, the first dimension of the array, must satisfy the constraint
.
, the initial matrix.
- 2:
– int64int32nag_int scalar
-
, the order of the leading principle submatrix .
Constraint:
.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the first dimension of the array
g and the second dimension of the array
g. (An error is raised if these dimensions are not equal.)
The order of the matrix .
Constraint:
.
- 2:
– double scalar
Default:
The termination tolerance for the iteration.
If
,
is used. See
Accuracy for further details.
- 3:
– double scalar
Default:
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.
Output Parameters
- 1:
– double array
-
A symmetric matrix with the diagonal set to .
- 2:
– double array
-
Contains the matrix .
- 3:
– double scalar
-
.
- 4:
– int64int32nag_int scalar
-
The number of iterations taken.
- 5:
– double scalar
-
The smallest eigenvalue of the leading principle submatrix .
- 6:
– double scalar
-
The value of after the final iteration.
- 7:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
The -by- principle leading submatrix of the initial matrix is not positive definite.
-
-
Failure to solve intermediate eigenproblem. This should not occur. Please contact
NAG.
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
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_lapack_dpotrf (f07fd).
The number of iterations taken for the bisection will be:
Further Comments
Arrays are internally allocated by nag_nearest_correlation_shrinking (g02an). The total size of these arrays does not exceed real elements. All allocated memory is freed before return of nag_nearest_correlation_shrinking (g02an).
Example
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,
Open in the MATLAB editor:
g02an_example
function g02an_example
fprintf('g02an example results\n\n');
g = [1.0000 -0.0991 0.5665 -0.5653 -0.3441;
-0.0991 1.0000 -0.4273 0.8474 0.4975;
0.5665 -0.4273 1.0000 -0.1837 -0.0585;
-0.5653 0.8474 -0.1837 1.0000 -0.2713;
-0.3441 0.4975 -0.0585 -0.2713 1.0000];
k = int64(3);
[g, x, alpha, iter, eigmin, norm_p, ifail] = ...
g02an(g,k);
fprintf('\nSymmetrised input matrix \n');
disp(g);
fprintf('Nearest Perturbed Correlation Matrix\n');
disp(x);
fprintf('k: %d\n', k);
fprintf('Number of iterations taken: %d\n', iter);
fprintf('alpha: %12.4f\n', alpha);
fprintf('Norm value: %12.4f\n', norm_p);
fprintf('Smallest eigenvalue of A: %12.4f\n', eigmin);
g02an example results
Symmetrised input matrix
1.0000 -0.0991 0.5665 -0.5653 -0.3441
-0.0991 1.0000 -0.4273 0.8474 0.4975
0.5665 -0.4273 1.0000 -0.1837 -0.0585
-0.5653 0.8474 -0.1837 1.0000 -0.2713
-0.3441 0.4975 -0.0585 -0.2713 1.0000
Nearest Perturbed Correlation Matrix
1.0000 -0.0991 0.5665 -0.3826 -0.2329
-0.0991 1.0000 -0.4273 0.5735 0.3367
0.5665 -0.4273 1.0000 -0.1243 -0.0396
-0.3826 0.5735 -0.1243 1.0000 -0.1836
-0.2329 0.3367 -0.0396 -0.1836 1.0000
k: 3
Number of iterations taken: 27
alpha: 0.3232
Norm value: 0.5624
Smallest eigenvalue of A: 0.3359
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015