I need to factor the covariance matrix to get a feeling for the properties and associations of the individual variables.
Consider the variables x and y with standard deviations 2 and 3 and correlation coefficient 0.6. The corresponding matrices are (cut and paste into the command line)
STDxy = [ 2 0 ; 0 3 ] CORxy = [ 1 0.6 ; 0.6 1 ]
% the corresponding covariance matrix is
COVxy = STDxy*CORxy*STDxy
COVxy = [ 2^2 2*3*0.6 ; 2*3*0.6 3^2 ]
% Conversely,
STDxy = sqrt(diag(diag(COVxy)))
CORxy = inv(STDxy)*COVxy*inv(STDxy)
Hope this helps.
Greg P.S. If one of the standard deviations is zero, replace inv with pinv.
Best Answer