[R] matrix which results singular but at the same time positive definite
r.turner at auckland.ac.nz
Thu Dec 10 11:38:22 CET 2015
On 10/12/15 23:08, Stefano Sofia wrote:
> Dear list users,
> through the "matrixcalc" package I am performing some checks of variance matrices (which must be positive definite).
> In this example, it happens that the matrix A here reported is singular but positive definite. Is it possible?
> [,1] [,2] [,3] [,4]
> [1,] 1.904255e-12 -1.904255e-12 -8.238960e-13 -1.240294e-12
> [2,] -1.904255e-12 3.637979e-12 1.364242e-12 1.818989e-12
> [3,] -8.238960e-13 1.364242e-12 4.809988e+00 7.742369e-01
> [4,] -1.240294e-12 1.818989e-12 7.742369e-01 1.090411e+00
> print(is.non.singular.matrix(A, tol = 1e-18))
> print(is.positive.definite(A, tol=1e-18))
> Is there something wrong with this matrix?
> Any comment will be appreciated.
There is nothing wrong with A (at least nothing that either a nice bowl
of chicken soup or a bloody good swim wouldn't cure).
Look at the code for the two functions. The tests use the tolerance in
very different ways.
My initial reaction is that the code for these functions is rather naive.
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
More information about the R-help