COV2CORR Function

COV2CORR (S) ;

The COV2CORR function is part of the IMLMLIB library. A correlation matrix estimates the correlations of centered and standardized variables, where each variable has been scaled by its standard deviation. The COV2CORR function converts a covariance matrix into a correlation matrix, as in the following example:

S = {1.0  1.0  8.1,
     1.0 16.0 18.0,
     8.1 18.0 81.0 };
R = Cov2Corr(S);
print R;

Figure 24.86: Correlation Matrix

R
1 0.25 0.9
0.25 1 0.5
0.9 0.5 1


The variances of the three variables are found on the diagonal of $S$. Equivalently, the square roots of the diagonal elements are the standard deviations. The COV2CORR function scales $S$ so that $R = D^{-1}SD^{-1}$, where $D=\mbox{diag}(\mbox{sd})$ is the diagonal matrix of standard deviations.