naginterfaces.library.correg.corrmat_​target

naginterfaces.library.correg.corrmat_target(g, theta, h, errtol=0.0, eigtol=0.0)[source]

corrmat_target computes a correlation matrix, by using a positive definite target matrix derived from weighting the approximate input matrix, with an optional bound on the minimum eigenvalue.

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

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

Parameters
gfloat, array-like, shape

, the initial matrix.

thetafloat

The value of . If , is used.

hfloat, array-like, shape

The matrix of weights .

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 the target matrix .

If , where and denote the minimum and maximum eigenvalues of respectively, is positive definite.

If , machine precision is used.

Returns
hfloat, ndarray, shape

A symmetric matrix with its diagonal elements set to .

xfloat, ndarray, shape

Contains the matrix .

alphafloat

The constant used in the formation of .

iteraint

The number of iterations taken.

eigminfloat

The smallest eigenvalue of the target matrix .

normfloat

The value of after the final iteration.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

The target matrix is not positive definite.

(errno )

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

Notes

Starting from an approximate correlation matrix, , corrmat_target finds a correlation matrix, , which has the form

where and is a target matrix. denotes the matrix with elements . is a matrix of weights that defines the target matrix. The target matrix must be positive definite and thus have off-diagonal elements less than in magnitude. A value of in essentially fixes an element in so it is unchanged in .

corrmat_target utilizes a shrinking method to find the minimum value of such that is positive definite with unit diagonal and with a smallest eigenvalue of at least times the smallest eigenvalue of the target matrix.

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