Stats.Nearest Correlation Matrix Method
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.9.0
Overload List
| Nearest | Returns a positive semi-definite matrix close to a matrix. |
| Nearest | Returns a positive semi-definite matrix close to a matrix. |
| Nearest | Returns a positive semi-definite matrix close to a matrix. |
NearestCorrelationMatrix(SymmetricMatrix<Double>)
public static SymmetricMatrix<double> NearestCorrelationMatrix(
SymmetricMatrix<double> matrix
)Parameters
- matrix SymmetricMatrix<Double>
- A symmetric matrix.
Return Value
SymmetricMatrix<Double>A symmetric matrix that is positive semi-definite. If matrix itself is positive semi-definite, it is returned unchanged.
Remarks
This method uses the alternating projections method of Nigham.
NearestCorrelationMatrix(SymmetricMatrix<Double>, NearestCorrelationMatrixAlgorithm)
public static SymmetricMatrix<double> NearestCorrelationMatrix(
SymmetricMatrix<double> matrix,
NearestCorrelationMatrixAlgorithm algorithm
)Parameters
- matrix SymmetricMatrix<Double>
- A symmetric matrix.
- algorithm NearestCorrelationMatrixAlgorithm
- Specifies the algorithm used to compute the matrix.
Return Value
SymmetricMatrix<Double>A symmetric matrix that is positive semi-definite. If matrix itself is positive semi-definite, it is returned unchanged.
Remarks
This method uses a method by Rebonato and Jäckel (scaled projection) or the alternating projections method of Nigham.
NearestCorrelationMatrix(SymmetricMatrix<Double>, NearestCorrelationMatrixAlgorithm, Double, Int32, Double)
public static SymmetricMatrix<double> NearestCorrelationMatrix(
SymmetricMatrix<double> matrix,
NearestCorrelationMatrixAlgorithm algorithm = NearestCorrelationMatrixAlgorithm.AlternatingProjections,
double tolerance = 1E-10,
int maxIterations = 100,
double minEigenvalue = 0
)Parameters
- matrix SymmetricMatrix<Double>
- A symmetric matrix.
- algorithm NearestCorrelationMatrixAlgorithm (Optional)
- Specifies the algorithm used to compute the matrix.
- tolerance Double (Optional)
- The relative tolerance used to test for convergence.
- maxIterations Int32 (Optional)
- The maximum number of iterations to perform.
- minEigenvalue Double (Optional)
- Optional. A minimum for the smallest eigenvalue of the returned matrix. The default value is zero.
Return Value
SymmetricMatrix<Double>A symmetric matrix that is positive semi-definite. If matrix itself is positive semi-definite, it is returned unchanged.
Remarks
This method uses a method by Rebonato and Jäckel (scaled projection) or the alternating projections method of Nigham.
Rebonato and Jäckel's method uses a direct approximation. The Nigham algorithm computes the matrix nearest to matrix in the sense that the sum of the squares of the differences between corresponding elements is minimized.
The input matrix is preserved. Alternating projections returns a positive semi-definite approximation when the iteration budget is exhausted; its diagonal may not yet equal one. Scaled projection normalizes the projected rows and, when necessary, mixes the result with the identity to enforce the eigenvalue floor.
Exceptions
| Argument | matrix is null. |
| Argument | tolerance is less than zero. -or- maxIterations is less than one. -or- minEigenvalue is less than zero. |