method: The method used to decompose v. Valid options are "chol", "eigen", or "svd".
Returns
Returns an N×N matrix.
Details
The "chol" method is the fastest but least stable method. The "eigen" method is slower, but more stable. The "svd" method is the slowest method, but should be the most stable.
Examples
# generate datan =100coords = matrix(runif(n*2), nrow = n, ncol =2)d = as.matrix(dist(coords))# create covariance matrixv =3* exp(-d/2)+0.1* diag(n)# decompose v using the three methodsd1 = decomp_cov(v,"chol")d2 = decomp_cov(v,"eigen")d3 = decomp_cov(v,"svd")# verify accuracy of decompositionsall.equal(v, tcrossprod(d1))all.equal(v, tcrossprod(d2), check.attributes =FALSE)all.equal(v, tcrossprod(d3), check.attributes =FALSE)