Learn R Programming

linpk (version 1.1.2)

cor2cov: Convert from standard deviation and correlation matrix to covariance matrix.

Description

Convert from standard deviation and correlation matrix to covariance matrix.

Usage

cor2cov(cor, sd)

Value

A covariance matrix.

Arguments

cor

A correlation matrix. If sd is missing, the diagonal entries are taken to be the standard deviations, otherwise they are ignored.

sd

A vector of standard deviations (optional).

Examples

Run this code
cor2cov(matrix(c(1, 0.5, 0.5, 1), 2, 2), 0.1)

Run the code above in your browser using DataLab