Adjust network matrix to be positive semi-definite
matrix
## S4 method for signature 'matrix' make_psd(x, eps = sqrt(.Machine$double.eps))
x
eps
numeric
The matrix x, if it is positive definite and the closest positive semi-definite matrix if x is not positive semi-definite.
For a matrix N, the closest positive semi-definite matrix is calculated as N* = rho*N + (1+rho)*I, where I is the identity matrix
and rho = 1/(1 - lambda) with lambda the smallest eigenvalue of N. For more details check the references.
set.seed(2345) m <- matrix(data=sample(size=25, c(0,0,1), replace=TRUE),5,5) m <- m + t(m) min(eigen(m, only.values = TRUE, symmetric = TRUE)$values) round(make_psd(m),2)
Juliane Manitz, Saskia Freytag, Stefanie Friedrichs
Useful links