is.positive.definite: Positive Definite

Description Usage Arguments Value Author(s) References Examples

View source: R/is.R

Description

Checks if eigenvalues in a square matrix are positive.

Usage

1
is.positive.definite(X, tol = 1e-08, stop = FALSE)

Arguments

X

Numeric matrix. Symmetric matrix.

tol

Numeric. Tolerance.

stop

Logical. If TRUE, stops and returns an error with any of the following conditions: X is not a square matrix, X is not a symmetric matrix, or X is not a positive definite matrix.

Value

Returns TRUE if the matrix is positive definite, that is, all eigenvalues are positive. Returns FALSE if the matrix is not positive definite, that is, any of the eigenvalues are are less than or equal to zero.

Author(s)

Ivan Jacob Agaloos Pesigan

References

Wikipedia: Definiteness of a Matrix

Examples

1
2
3
4
5
6
7
8
9
Sigma <- matrix(
  data = c(
    225, 112.50, 56.25,
    112.5, 225, 112.5,
    56.25, 112.50, 225
  ),
  ncol = 3
)
is.positive.definite(X = Sigma)

jeksterslabds/jeksterslabRmatrix documentation built on Aug. 4, 2020, 5:18 a.m.