powered by
Create Covariance Matrix
covariance_matrix(diag, upper_tri)
A symmetric matrix with diag values on the main diagonal and upper_tri values in the lower and upper triangles.
diag
upper_tri
Diagonal entries of the covariance matrix
Upper triangle entries of the matrix, specified column wise.
m1 <- covariance_matrix(c(1, 1, 1, 1), c(.8, .3, .8, 0, 0, 0)) m1 mvtnorm::rmvnorm(5, mean = c(0, 0, 0, 0), sigma = m1) # No correlation covariance_matrix(c(1, 2, 3))
Run the code above in your browser using DataLab