powered by
Extracting correlations from a covariance matrix
extractCorr(mat)
The correlation matrix embedded in mat.
mat
A covariance matrix.
# 2 dimensional case d <- 2 tmp <- matrix(rnorm(d^2), d, d) mcov <- tcrossprod(tmp, tmp) # Covariance matrix mcov # Correlation matrix extractCorr(mcov)
Run the code above in your browser using DataLab