cor2cov: Correlation Matrix to Covariance Matrix Conversion

Description Usage Arguments Details Note Author(s)

View source: R/cor2cov.R

Description

Function to convert a correlation matrix to a covariance matrix.

Usage

1
cor2cov(cor.mat, sd, discrepancy = 1e-05)

Arguments

cor.mat

the correlation matrix to be converted

sd

a vector that contains the standard deviations of the variables in the correlation matrix

discrepancy

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

Details

The correlation matrix to convert can be either symmetric or triangular. The covariance matrix returned is always a symmetric matrix.

Note

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; discrepancy specifies 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).

Author(s)

Ken Kelley (University of Notre Dame; (KKelley@ND.Edu) and Keke Lai (the MBESS package), with modifications by Dustin Fife fife.dustin@gmail.com.


fifer documentation built on May 30, 2017, 7:40 a.m.

Related to cor2cov in fifer...