solvecov: Inversion of (possibly singular) symmetric matrices

View source: R/fpc.R

solvecovR Documentation

Inversion of (possibly singular) symmetric matrices

Description

Tries to invert a matrix by solve. If this fails because of singularity, an eigenvector decomposition is computed, and eigenvalues below 1/cmax are replaced by 1/cmax, i.e., cmax will be the corresponding eigenvalue of the inverted matrix.

Usage

solvecov(m, cmax = 1e+10)

Arguments

m

a numeric symmetric matrix.

cmax

a positive value, see above.

Value

A list with the following components:

inv

the inverted matrix

coll

TRUE if solve failed because of singularity.

Author(s)

Christian Hennig christian.hennig@unibo.it https://www.unibo.it/sitoweb/christian.hennig/en/

See Also

solve, eigen

Examples

  x <- c(1,0,0,1,0,1,0,0,1)
  dim(x) <- c(3,3)
  solvecov(x)

fpc documentation built on Sept. 24, 2024, 9:07 a.m.