powered by
Convert correlation to covariance
cor2cov(V, sd, empirical = FALSE)cor2cov_ar(V, sd, empirical = FALSE)
cor2cov_ar(V, sd, empirical = FALSE)
A correlation matrix.
A correlation matrix, usually positive semi-definite.
A vector of standard deviations.
Logical; TRUE if V is empirical correlation.
cor2cov converts a matrix. cor2cov_ar converts an 3-D array.
cor2cov
cor2cov_ar
V <- matrix(c(1, 0.5, 0.5, 1), ncol = 2) sd <- 1:2 cor2cov(V, sd) V_ar <- array(c(1, 0.5, 0.5, 1), dim = c(2, 2, 2)) cor2cov_ar(V_ar, sd)
Run the code above in your browser using DataLab