chol {BNSP}R Documentation

The Cholesky and modified Cholesky decompositions

Description

Computes the Cholesky factorization and modified Cholesky factorizations of a real symmetric positive-definite square matrix.

Usage

chol(x, mod = TRUE, p = 1, ...)

Arguments

x

A symmetric, positive-definite matrix.

mod

Defaults to TRUE. With this choice, the function returns the modified Cholesky decomposition. When mod = FALSE, the function returns the usual Cholesky decomposition.

p

Relevant only when mod = TRUE. It determines the size of the blocks of the block diagonal matrix.

...

other arguments.

Details

The function computes the modified Cholesky decomposition of a real symmetric positive-definite square matrix Σ. This is given by

L Σ L^{\top} = D,

where L is a lower tringular matrix with ones on its main diagonal and D is a block diagonal matrix with block size determined by argument p.

Value

The function returns matrices L and D.

Author(s)

Georgios Papageorgiou gpapageo@gmail.com

See Also

The default function from base, chol

Examples

Sigma <- matrix(c(1.21,0.18,0.13,0.41,0.06,0.23,
                  0.18,0.64,0.10,-0.16,0.23,0.07,
                  0.13,0.10,0.36,-0.10,0.03,0.18,
                  0.41,-0.16,-0.10,1.05,-0.29,-0.08,
                  0.06,0.23,0.03,-0.29,1.71,-0.10,
                  0.23,0.07,0.18,-0.08,-0.10,0.36),6,6)
LD <- chol(Sigma)
L <- LD$L
D <- LD$D
round(L,5)
round(D,5)
solve(L) %*% D %*% solve(t(L))
LD <- chol(Sigma, p = 2)
L <- LD$L
D <- LD$D
round(L, 5)
round(D, 5)
solve(L) %*% D %*% solve(t(L))

[Package BNSP version 2.1.6 Index]