NAG Library Function Document
nag_nearest_correlation_k_factor (g02aec)
1 Purpose
nag_nearest_correlation_k_factor (g02aec) computes the factor loading matrix associated with the nearest correlation matrix with -factor structure, in the Frobenius norm, to a given square, input matrix.
2 Specification
| #include <nag.h> |
| #include <nagg02.h> |
| void |
nag_nearest_correlation_k_factor (Nag_OrderType order,
double g[],
Integer pdg,
Integer n,
Integer k,
double errtol,
Integer maxit,
double x[],
Integer pdx,
Integer *iter,
Integer *feval,
double *nrmpgd,
NagError *fail) |
|
3 Description
A correlation matrix with -factor structure may be characterized 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.
nag_nearest_correlation_k_factor (g02aec) 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.
4 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
5 Arguments
- 1:
order – Nag_OrderTypeInput
-
On entry: the
order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by
. See
Section 3.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint:
or Nag_ColMajor.
- 2:
g[] – doubleInput/Output
-
Note: the dimension,
dim, of the array
g
must be at least
.
The
th element of the matrix
is stored in
- when ;
- when .
On entry: , the initial matrix.
On exit: a symmetric matrix with the diagonal elements set to unity.
- 3:
pdg – IntegerInput
-
On entry: the stride separating row or column elements (depending on the value of
order) in the array
g.
Constraint:
.
- 4:
n – IntegerInput
-
On entry:
, the order of the matrix .
Constraint:
.
- 5:
k – IntegerInput
-
On entry:
, the number of factors and columns of .
Constraint:
.
- 6:
errtol – doubleInput
-
On entry: the termination tolerance for the projected gradient norm. See references for further details. If then is used. This is often a suitable default value.
- 7:
maxit – IntegerInput
-
On entry: specifies the maximum number of iterations in the spectral projected gradient method.
If , is used.
- 8:
x[] – doubleOutput
-
Note: the dimension,
dim, of the array
x
must be at least
- when ;
- when .
The
th element of the matrix
is stored in
- when ;
- when .
On exit: contains the matrix .
- 9:
pdx – IntegerInput
-
On entry: the stride separating row or column elements (depending on the value of
order) in the array
x.
Constraints:
- if ,
;
- if , .
- 10:
iter – Integer *Output
-
On exit: the number of steps taken in the spectral projected gradient method.
- 11:
feval – Integer *Output
-
On exit: the number of evaluations .
- 12:
nrmpgd – double *Output
-
On exit: the norm of the projected gradient at the final iteration.
- 13:
fail – NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
6 Error Indicators and Warnings
- NE_ALLOC_FAIL
Dynamic memory allocation failed.
- NE_BAD_PARAM
On entry, argument had an illegal value.
- NE_CONVERGENCE
Spectral gradient method fails to converge in iterations.
- NE_INT
On entry, .
Constraint: .
- NE_INT_2
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
- NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact
NAG for assistance.
7 Accuracy
The returned accuracy is controlled by
errtol and limited by
machine precision.
Arrays are internally allocated by nag_nearest_correlation_k_factor (g02aec). The total size of these arrays is
double elements and
Integer elements.
There is an additional
double elements if
.
Here
is the block size required for optimal performance by
nag_dsytrd (f08fec) and
nag_dormtr (f08fgc) which are called internally. All allocated memory is freed before return of nag_nearest_correlation_k_factor (g02aec).
See
nag_mv_factor (g03cac) for constructing the factor loading matrix from a known correlation matrix.
9 Example
This example finds the nearest correlation matrix with
factor structure to:
9.1 Program Text
Program Text (g02aece.c)
9.2 Program Data
Program Data (g02aece.d)
9.3 Program Results
Program Results (g02aece.r)