Learn R Programming

MagmaClustR (version 1.2.1)

chol_inv_jitter: Inverse a matrix using an adaptive jitter term

Description

Inverse a matrix from its Choleski decomposition. If (nearly-)singular, increase the order of magnitude of the jitter term added to the diagonal until the matrix becomes non-singular.

Usage

chol_inv_jitter(mat, pen_diag)

Value

A matrix, inverse of mat plus an adaptive jitter term added on the diagonal.

Arguments

mat

A matrix, possibly singular.

pen_diag

A number, a jitter term to add on the diagonal.

Examples

Run this code
TRUE

Run the code above in your browser using DataLab