cov2cor: Convert covariance matrix to correlation

Description Usage Arguments Value Author(s) Examples

Description

This functions converts a covariance matrix S to a correlation matrix fast and efficiently.

Usage

1
2
3

Arguments

S

A square covariance matrix.

Value

A square correlation matrix.

Author(s)

Anders Ellern Bilgrau <anders.ellern.bilgrau (at) gmail.com>

Examples

1
2
3
4
5
6
7
8
9
X <- createData(n = 11, m = 4)
S <- cov(X)
stats::cov2cor(S)
cov2corArma(S)
if (require(microbenchmark)) {
  microbenchmark(A = cov2corArma(S),
                 B = stats::cov2cor(S),
                 C = cov2cor(S))
}

AEBilgrau/correlateR documentation built on June 1, 2019, 9:11 p.m.