nearestPD {Karen} | R Documentation |
Nearest Positive Definite Matrix
Description
This function first check if a matrix A is positive definite, typically a correlation or variance-covariance matrix. If A is not positive definite, this function computes the nearest positive definite matrix of A using the function nearPD from package Matrix.
Usage
nearestPD(A, ...)
Arguments
A |
numeric |
... |
Further arguments to be passed to nearPD (see package Matrix for details). |
Value
The nearest positive definite matrix of A.
Examples
nearestPD(diag(c(1,0,1)))
[Package Karen version 1.0 Index]