nearestPD {Karen} | R Documentation |
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.
nearestPD(A, ...)
A |
numeric |
... |
Further arguments to be passed to nearPD (see package Matrix for details). |
The nearest positive definite matrix of A.
nearestPD(diag(c(1,0,1)))