simPATHy (version 0.6)

makePositiveDefinite: Positive definite matrix

Description

Adjust the diagonal of a symmetric square matrix, by the smallest eigenvalue method, in order to make it positive definite.

Usage

makePositiveDefinite(M1, M2 = NULL, threshold = 0.1)

Arguments

M1, M2

A squared numeric matrix, typically a correlation or a covariance matrix. It must be symmetric.

threshold

A correction factor.

Value

A list with the corrected input matrices and the correction threshold-lambda.

Details

Finds the smallest eigenvalue lambda of M1 (or M1 and M2 if supplied) and adds (threshold-lambda) to the diagonal to make it positive definite.