makePositiveDefinite: Positive definite matrix

Description Usage Arguments Details Value

View source: R/main_function.R

Description

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

Usage

1
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.

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.

Value

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


simPATHy documentation built on Nov. 23, 2021, 5:07 p.m.