powered by
These functions compute the Cholesky root elements of a covariance matrix and, conversely, build a covariance matrix from its Cholesky root elements.
cov_2_chol(cov, unique = TRUE)chol_2_cov(chol)unique_chol(chol)
chol_2_cov(chol)
unique_chol(chol)
For cov_2_chol a numeric
cov_2_chol
numeric
vector of Cholesky root elements. For chol_2_cov a covariance matrix.
vector
chol_2_cov
matrix
A covariance matrix of dimension dim.
dim
Set to TRUE to ensure that the Cholesky decomposition is unique by restricting the diagonal elements to be positive.
TRUE
A numeric vector of Cholesky root elements.
cov <- sample_covariance_matrix(4) chol <- cov_2_chol(cov) all.equal(cov, chol_2_cov(chol))
Run the code above in your browser using DataLab