Dear Stefano, You've already had a couple of informative responses directly addressing your question, but are you aware how ill-conditioned the matrix is (one of the responses alluded to this)?
> kappa(X, exact=TRUE) [1] 7.313338e+12 > eigen(X)$values [1] 4.964711e+00 9.356881e-01 4.863392e-12 6.788344e-13 Two of the variables have variances around 10^0 and the other two around 10^-12. Of course, you haven't said anything about the context, but does it really make sense to analyze the data on these scales? Best, John ----------------------------- John Fox, Professor McMaster University Hamilton, Ontario Canada L8S 4M4 Web: socserv.mcmaster.ca/jfox > -----Original Message----- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Stefano Sofia > Sent: December 10, 2015 5:08 AM > To: r-help@r-project.org > Subject: [R] matrix which results singular but at the same time positive > definite > > 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)) FALSE > print(is.positive.definite(A, > tol=1e-18)) TRUE > > Is there something wrong with this matrix? > Any comment will be appreciated. > Stefano > > > ________________________________ > > AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere > informazioni confidenziali, pertanto è destinato solo a persone autorizzate > alla > ricezione. I messaggi di posta elettronica per i client di Regione Marche > possono contenere informazioni confidenziali e con privilegi legali. Se non > si è il > destinatario specificato, non leggere, copiare, inoltrare o archiviare questo > messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al > mittente > ed eliminarlo completamente dal sistema del proprio computer. Ai sensi > dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed > urgenza, la risposta al presente messaggio di posta elettronica può essere > visionata da persone estranee al destinatario. > IMPORTANT NOTICE: This e-mail message is intended to be received only by > persons entitled to receive the confidential information it may contain. > E-mail > messages to clients of Regione Marche may contain information that is > confidential and legally privileged. Please do not read, copy, forward, or > store > this message unless you are an intended recipient of it. If you have received > this message in error, please forward it to the sender and delete it > completely > from your computer system. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.