Stats.NearestCorrelationMatrix Method

Definition

Namespace: Numerics.NET.Statistics
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.3

Overload List

NearestCorrelationMatrix(SymmetricMatrix<Double>) Returns a positive semi-definite matrix close to a matrix.
NearestCorrelationMatrix(SymmetricMatrix<Double>, NearestCorrelationMatrixAlgorithm) Returns a positive semi-definite matrix close to a matrix.
NearestCorrelationMatrix(SymmetricMatrix<Double>, NearestCorrelationMatrixAlgorithm, Double, Int32, Double) Returns a positive semi-definite matrix close to a matrix.

NearestCorrelationMatrix(SymmetricMatrix<Double>)

Returns a positive semi-definite matrix close to a matrix.
C#
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)

Returns a positive semi-definite matrix close to a matrix.
C#
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)

Returns a positive semi-definite matrix close to a matrix.
C#
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.

Exceptions

ArgumentOutOfRangeException

tolerance is less than zero.

-or-

maxIterations is less than one.

-or-

minEigenvalue is less than zero.

See Also