Learn R Programming

stremo (version 0.2)

cor2cov: Covariance matrix from a correlation matrix.

Description

Build a covariance matrix from a correlation matrix and variables standard deviations.

Usage

cor2cov(cormat, sds)

Arguments

cormat
Correlation matrix to be transformed.
sds
Vector of standard deviations.

Value

Covariance matrix.

See Also

cov2cor, mirror.tri

Examples

Run this code
covmat <- ability.cov$cov
sds <- sqrt(diag(covmat))
cormat <- cov2cor(covmat)

covmat.trans <- cor2cov(cormat, sds)
round(covmat - covmat.trans, 10)

Run the code above in your browser using DataLab