nearest_pd | R Documentation |
This function computes the nearest positive-definite matrix to some matrix A
.
nearest_pd(X)
X |
Either a numeric vector or a square matrix. If a vector is provided, a matrix will be created of the form found in cyclic_matrix. |
This function computes the nearest positive-definite matrix to some matrix A
.
The procedure to do so is as follows
For a matrix X
, compute the symmetric matrix B = (A + A^{T}) / 2.
Let B = UH
be the polar decomposition of B.
The nearest positive-definite matrix to X
is X_{F} = (B + H) / 2.
Unlike shrinking, only an autocorrelation matrix can be returned, not an autocovariance function.
The implementation is a translation of https://au.mathworks.com/matlabcentral/fileexchange/42885-nearestspd#functions_tab .
The closest positive-definite autocorrelation matrix.
Higham, N. J. (1988). Computing a nearest symmetric positive semidefinite matrix. Linear Algebra and its Applications, 103, 103–118. https://doi.org/10.1016/0024-3795(88)90223-6
D'Errico, J. (2025). nearestSPD (https://www.mathwor ks.com/matlabcentral/fileexchange/42885-nearestspd), MATLAB Central File Exchange. Retrieved August 2, 2025.
X <- c(1, 0, -1.1)
nearest_pd(X)
check_pd(nearest_pd(X))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.