The same approach as in `base::cov2cor()` is used to compute the variance-covariance matrix from a matrix of correlations and a vector of variance values.

cor_to_cov(pmat_cor, pvec_var)

Arguments

pmat_cor

correlation matrix

pvec_var

vector of variance components

Value

variance covariance matrix

Examples

## Taken from ?cov2cor: Correlation Matrix of Multivariate sample: Cv <- cov(longley) Cl <- cor(longley) stopifnot(all.equal(cor_to_cov(Cl, diag(Cv)), Cv))