naginterfaces.library.correg.corrmat_nearest_kfactor¶
- naginterfaces.library.correg.corrmat_nearest_kfactor(g, k, errtol=0.0, maxit=0)[source]¶
corrmat_nearest_kfactor
computes the factor loading matrix associated with the nearest correlation matrix with -factor structure, in the Frobenius norm, to a given square, input matrix.For full information please refer to the NAG Library document for g02ae
https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/g02/g02aef.html
- Parameters
- gfloat, array-like, shape
, the initial matrix.
- kint
, the number of factors and columns of .
- errtolfloat, optional
The termination tolerance for the projected gradient norm. See references for further details. If , is used. This is often a suitable default value.
- maxitint, optional
Specifies the maximum number of iterations in the spectral projected gradient method.
If , is used.
- Returns
- xfloat, ndarray, shape
Contains the matrix .
- iteraint
The number of steps taken in the spectral projected gradient method.
- fevalint
The number of evaluations of .
- nrmpgdfloat
The norm of the projected gradient at the final iteration.
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, and .
Constraint: .
- (errno )
Spectral gradient method fails to converge in iterations.
- Notes
A correlation matrix with -factor structure may be characterised as a real square matrix that is symmetric, has a unit diagonal, is positive semidefinite and can be written as , where is the identity matrix and has rows and columns. is often referred to as the factor loading matrix.
corrmat_nearest_kfactor
applies a spectral projected gradient method to the modified problem such that , for , where is the th row of the factor loading matrix, , which gives us the solution.
- References
Birgin, E G, Martínez, J M and Raydan, M, 2001, Algorithm 813: SPG–software for convex-constrained optimization, ACM Trans. Math. Software (27), 340–349
Borsdorf, R, Higham, N J and Raydan, M, 2010, Computing a nearest correlation matrix with factor structure, SIAM J. Matrix Anal. Appl. (31(5)), 2603–2622