Learn R Programming

qfratio (version 1.1.1)

KiK: Matrix square root and generalized inverse

Description

This internal function calculates the decomposition \(\mathbf{S} = \mathbf{K} \mathbf{K}^T\) for an \(n \times n\) covariance matrix \(\mathbf{S}\), so that \(\mathbf{K}\) is an \(n \times m\) matrix with \(m\) being the rank of \(\mathbf{S}\). Returns this \(\mathbf{K}\) and its generalized inverse, \(\mathbf{K}^-\), in a list.

Usage

KiK(S, tol = .Machine$double.eps * 100)

Value

List with K and iK, with the latter being \(\mathbf{K}^-\)

Arguments

S

Covariance matrix. Symmetry and positive (semi-)definiteness are checked.

tol

Tolerance to determine the rank of \(\mathbf{S}\). Eigenvalues smaller than this value are considered zero.

Details

At present, this utilizes svd(), although there may be better alternatives.