cov2cor: Convert covariance matrix to correlation

Description Usage Arguments Value Author(s) Examples

View source: R/cov2cor.R

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 Nov. 15, 2019, 9:21 a.m.