ISMATRIXPSD
Verify if a matrix is positive semidefinite. Solve for the nearest positive semidefinite matrix if it is not.
Description
Positive semidefinite matrices are useful in portfolio theory because they are symmetric and easy to decompose. This is particularly useful for optimization (e.g. Cholsky decomposition). When a matrix is symmetric and positive semidefinite, we can decompose it in a lower triangular matrix and find its inverse - which is computationally more efficient than inverting a matrix. Positive semidefinite matrices are a special case of symmetric matrices and is a good check for covariance and correlation matrices.
This function allows you to check if your matrix is positive semidefinite, and if it isn't it will perturb its elements to solve for the nearest positive semidefinite matrix.
We consider a matrix positive semidefinite if its characteristic roots are greater or equal to zero.
Syntax
The following describes the function signature for use in Microsoft Excel's formula bar.
Input(s)
Argument | Description |
---|---|
x | Matrix to evaluate or solve. |
isSolveNearest | Optional logical (TRUE or FALSE) flag. If true, the function will solve and return the nearest positive semidefinite matrix, otherwise it will only evaluate whether x is positive semidefinite or not. If the argument is not specified, the function defaults to false. |
Output(s)
The function's output will vary depending on the specification of the isSolveNearest
argument. The following table will describe the corresponding output result.
Logical whether x is positive semidefinite or otherwise. Nearest positive semidefinite matrix
isSolveNearest | Output |
---|---|
true | Square matrix of the nearest positive semidefinite matrix relative to |
false (default) | Logical indicating whether input square matrix |
Example
Last updated