naginterfaces.library.correg.corrmat_​shrinking

naginterfaces.library.correg.corrmat_shrinking(g, k, errtol=0.0, eigtol=0.0)[source]

corrmat_shrinking computes a correlation matrix, subject to preserving a leading principal submatrix and applying the smallest relative perturbation to the remainder of the approximate input matrix.

For full information please refer to the NAG Library document for g02an

https://www.nag.com/numeric/nl/nagdoc_27.1/flhtml/g02/g02anf.html

Parameters
gfloat, array-like, shape

, the initial matrix.

kint

, the order of the leading principal submatrix .

errtolfloat, optional

The termination tolerance for the iteration.

If , is used.

See Accuracy for further details.

eigtolfloat, optional

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.

Returns
xfloat, ndarray, shape

Contains the matrix .

alphafloat

.

iteraint

The number of iterations taken.

eigminfloat

The smallest eigenvalue of the leading principal submatrix .

normfloat

The value of after the final iteration.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

The principal leading submatrix of the initial matrix is not positive definite.

(errno )

Failure to solve intermediate eigenproblem. This should not occur. Please contact NAG.

Notes

corrmat_shrinking finds a correlation matrix, , starting from an approximate correlation matrix, , with positive definite leading principal submatrix of order . The returned correlation matrix, , has the following structure:

where is the leading principal submatrix of the input matrix and positive definite, and .

corrmat_shrinking 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