chol {BNSP} | R Documentation |
Computes the Cholesky factorization and modified Cholesky factorizations of a real symmetric positive-definite square matrix.
chol(x, mod = TRUE, p = 1, ...)
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 |
... |
other arguments. |
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
.
The function returns matrices L and D.
Georgios Papageorgiou gpapageo@gmail.com
The default function from base, chol
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))