safe_cov_inverse: Computes a numerically stable inverse of a covariance matrix

View source: R/shared.R

safe_cov_inverseR Documentation

Computes a numerically stable inverse of a covariance matrix

Description

Computes a numerically stable inverse of a covariance matrix

Usage

safe_cov_inverse(X, ridge = 1e-08, max_ridge_steps = 6)

Arguments

X

The n x p design matrix

ridge

Initial ridge penalty added to the diagonal

max_ridge_steps

Maximum number of ridge escalation attempts

Value

The inverse covariance matrix

Author(s)

Adam Kapelner

Examples

## Not run: 
X = matrix(rnorm(20), nrow = 10)
Sinv = safe_cov_inverse(X)
dim(Sinv)

## End(Not run)

GreedyExperimentalDesign documentation built on Jan. 9, 2026, 5:07 p.m.