View source: R/quadratic_forms.R
get_nearest_psd_matrix | R Documentation |
Approximates a symmetric, real matrix by the nearest positive semidefinite matrix in the Frobenius norm, using the method of Higham (1988). For a real, symmetric matrix, this is equivalent to "zeroing out" negative eigenvalues. See the "Details" section for more information.
get_nearest_psd_matrix(X)
X |
A symmetric, real matrix with no missing values. |
Let A
denote a symmetric, real matrix which is not positive semidefinite.
Then we can form the spectral decomposition A=\Gamma \Lambda \Gamma^{\prime}
,
where \Lambda
is the diagonal matrix
whose entries are eigenvalues of A
.
The method of Higham (1988) is to approximate
A
with \tilde{A} = \Gamma \Lambda_{+} \Gamma^{\prime}
,
where the ii
-th entry of \Lambda_{+}
is \max(\Lambda_{ii}, 0)
.
The nearest positive semidefinite matrix
of the same dimension as X
.
- Higham, N. J. (1988). "Computing a nearest symmetric positive semidefinite matrix." Linear Algebra and Its Applications, 103, 103–118.
X <- matrix(
c(2, 5, 5,
5, 2, 5,
5, 5, 2),
nrow = 3, byrow = TRUE
)
get_nearest_psd_matrix(X)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.