nearPD | R Documentation |
This function finds the nearest symmetric positive definite matrix to the given matrix. It is used throughout the package to handle numerical issues in matrix inverses and cholesky decompositions.
nearPD(K0)
K0 |
A square matrix |
The closest symmetric positive definite matrix to K0.
Adapted from Matlab code by John D'Errico
Higham, N. J. (1988). Computing a nearest symmetric positive semidefinite matrix. Linear Algebra and its Applications, 103, 103-118.
D'Errico, J. (2013). nearestSPD Matlab function. https://uk.mathworks.com/matlabcentral/fileexchange/42885-nearestspd.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.