powered by
Given the variances and desired correlations, generate a covariance matrix
get_covmat(cormat, var)
A symmetric matrix with desired correlations.
A numeric vector with variances. It must have length equal to the number of elements in the diagonal of cormat.
cormat
A (co)variance matrix
# NOT RUN { cormat <- matrix(c(1, 0.9, -0.4, 0.9, 1, 0.6, -0.4, 0.6, 1), nrow = 3, ncol = 3) get_covmat(cormat, var = c(16, 25, 9)) # } # NOT RUN { # }
Run the code above in your browser using DataLab