cor2cov: Convert from Correlation Matrix to Covariance Matrix

View source: R/RcppExports.R

cor2covR Documentation

Convert from Correlation Matrix to Covariance Matrix

Description

Convert a correlation matrix to a covariance matrix.

Usage

cor2cov(sigma, corrMatrix)

Arguments

sigma

A vector of standard deviations for the variables you're describing. Length must be the same as the number of rows/columns of CorrMatrix.

corrMatrix

A valid correlation matrix.

Value

A covariance matrix with the same dimensions as corrMatrix.

Examples

corr <- matrix(c(1, 0.53, 0.73, 0.53, 1, 0.44, 0.73, 0.44, 1), nrow = 3)
sigmas <- c(2, 0.3, 1.2)
covar <- cor2cov(sigmas, corr)
cov2cor(covar)

colorednoise documentation built on May 29, 2024, 9:21 a.m.