cov_2_chol {oeli}R Documentation

Get Cholesky root elements and build covariance matrix

Description

These functions compute the Cholesky root elements of a covariance matrix and, conversely, build a covariance matrix from its Cholesky root elements.

Usage

cov_2_chol(cov, unique = TRUE)

chol_2_cov(chol)

unique_chol(chol)

Arguments

cov

A covariance matrix of dimension dim.

unique

Set to TRUE to ensure that the Cholesky decomposition is unique by restricting the diagonal elements to be positive.

chol

A numeric vector of Cholesky root elements.

Value

For cov_2_chol a numeric vector of Cholesky root elements. For chol_2_cov a covariance matrix.

Examples

cov <- sample_covariance_matrix(4)
chol <- cov_2_chol(cov)
all.equal(cov, chol_2_cov(chol))


[Package oeli version 0.5.2 Index]