## most likely generates a matrix which is close to positive definite
## but not quite
s <- matrix(rnorm(100), ncol=5)
S <- (t(s) %*% s) + matrix(rnorm(25, sd=10), ncol=5)
S
## a correction, quiet=TRUE so there is no warning printed
posdef.approx(S, quiet=TRUE)
Run the code above in your browser using DataLab