Learn R Programming

micEcon (version 0.4-0)

semidefiniteness: Test for negative and positive semidefiniteness

Description

Test wether a symmetric matrix is negative semidefinite, positive semidefinite, both of them or none of them.

Usage

semidefiniteness( m, tol = .Machine$double.eps, method = "det" )

Arguments

m
a quadratic matrix
tol
tolerance level (values between -tol and tol are considered to be zero).
method
method to test for semidefiniteness, either "det" (the textbook method: checking for the signs of the determinants of sub-matrices) or "eigen" (checking for the signs of the eigen values).

References

Chiang, A.C. (1984) Fundamental Methods of Mathematical Economics, 3rd ed., McGraw-Hill.

Examples

Run this code
# a positive semidefinite matrix
   semidefiniteness( matrix( 1, 3, 3 ))

   # a negative semidefinite matrix
   semidefiniteness( matrix(-1, 3, 3 ))

   # a matrix that is positive and negative semidefinite
   semidefiniteness( matrix( 0, 3, 3 ))

   # a matrix that is neither positive nor negative semidefinite
   semidefiniteness( matrix( 1:9, 3, 3 ))

Run the code above in your browser using DataLab