Learn R Programming

synlik (version 0.1.6)

extractCorr: Extracting correlations from a covariance matrix

Description

Extracting correlations from a covariance matrix

Usage

extractCorr(mat)

Value

The correlation matrix embedded in mat.

Arguments

mat

A covariance matrix.

Examples

Run this code
# 2 dimensional case
d <- 2
tmp <- matrix(rnorm(d^2), d, d)
mcov <- tcrossprod(tmp, tmp)

# Covariance matrix
mcov

# Correlation matrix
extractCorr(mcov)

Run the code above in your browser using DataLab