Function to convert a correlation matrix to a covariance matrix.
the correlation matrix to be converted
a vector that contains the standard deviations of the variables in the correlation matrix
a neighborhood of 1, such that numbers on the main diagonal of the correlation matrix will be considered as equal to 1 if they fall in this neighborhood
The correlation matrix to convert can be either symmetric or triangular. The covariance matrix returned is always a symmetric matrix.
The correlation matrix input should be a square matrix, and the length of
sd should be equal to
the number of variables in the correlation matrix (i.e., the number of rows/columns). Sometimes the correlation
matrix input may not have exactly 1's on the main diagonal, due to, eg, rounding;
the allowable discrepancy so that the function still considers the input as a correlation matrix and can
proceed (but the function does not change the numbers on the main diagonal).
Ken Kelley (University of Notre Dame; [email protected]), Keke Lai
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.