Hi uRsers,
when inverting a 2 by 2 matrix using solve, I encountered a error message:
solve.default(sigma, tol = 1e-07) :
system is computationally singular: reciprocal condition number
= 1.7671e-017
and then I test the determinant of this matrix: 6.341393e-06.
In my program, I have a condition block that whether a matrix is
invertible like this:
if(det(sigma)<1e-7) return NULL;
but this seems doesnot work to prevent the singularity when inverting a
matrix. I am some confused about the relationship between "reciprocal
condition number" and determinant. Can anybody give me some idea how to
prevent this situation?
Thanks a lot!
Xiaohui
Hi uRsers,
when inverting a 2 by 2 matrix using solve, I encountered a error message:
solve.default(sigma, tol = 1e-07) :
system is computationally singular: reciprocal condition number
= 1.7671e-017
and then I test the determinant of this matrix: 6.341393e-06.
In my program, I have a condition block that whether a matrix is
invertible like this:
if(det(sigma)<1e-7) return NULL;
but this seems doesnot work to prevent the singularity when inverting a
matrix. I am some confused about the relationship between "reciprocal
condition number" and determinant. Can anybody give me some idea how to
prevent this situation?
Thanks a lot!
Xiaohui
Hi uRsers,
when inverting a 2 by 2 matrix using solve, I encountered a error message:
solve.default(sigma, tol = 1e-07) :
system is computationally singular: reciprocal condition number
= 1.7671e-017
and then I test the determinant of this matrix: 6.341393e-06.
In my program, I have a condition block that whether a matrix is
invertible like this:
if(det(sigma)<1e-7) return NULL;
but this seems doesnot work to prevent the singularity when inverting a
matrix. I am some confused about the relationship between "reciprocal
condition number" and determinant. Can anybody give me some idea how to
prevent this situation?
Thanks a lot!
Xiaohui
For heaven's sake, please stop sending repeat emails and send your R code
that can reproduce the error.
Ravi.
----------------------------------------------------------------------------
-------
Ravi Varadhan, Ph.D.
Assistant Professor, The Center on Aging and Health
Division of Geriatric Medicine and Gerontology
Johns Hopkins University
Ph: (410) 502-2619
Fax: (410) 614-9625
Email: rvaradhan at jhmi.edu
Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html
----------------------------------------------------------------------------
--------
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of xchen
Sent: Tuesday, November 07, 2006 2:46 PM
To: r-help at stat.math.ethz.ch
Subject: [R] solve computationally singular
Hi uRsers,
when inverting a 2 by 2 matrix using solve, I encountered a error message:
solve.default(sigma, tol = 1e-07) :
system is computationally singular: reciprocal condition number
= 1.7671e-017
and then I test the determinant of this matrix: 6.341393e-06.
In my program, I have a condition block that whether a matrix is
invertible like this:
if(det(sigma)<1e-7) return NULL;
but this seems doesnot work to prevent the singularity when inverting a
matrix. I am some confused about the relationship between "reciprocal
condition number" and determinant. Can anybody give me some idea how to
prevent this situation?
Thanks a lot!
Xiaohui
______________________________________________
R-help at stat.math.ethz.ch mailing list
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.
On Tuesday 07 November 2006 19:46, xchen wrote:> Hi uRsers, > > when inverting a 2 by 2 matrix using solve, I encountered a error message: > solve.default(sigma, tol = 1e-07) : > system is computationally singular: reciprocal condition number > = 1.7671e-017 > > and then I test the determinant of this matrix: 6.341393e-06. > > In my program, I have a condition block that whether a matrix is > invertible like this: > if(det(sigma)<1e-7) return NULL;- the determinant isn' t the best way of testing for computational singularity. For example, in the following `a' is computationally singular (it has a condition number of 1e18, but it has a determinant of 1e-6) a<- diag(c(1e6,1e-12))> a[,1] [,2] [1,] 1e+06 0e+00 [2,] 0e+00 1e-12> det(a)[1] 1e-06> solve(a)Error in solve.default(a) : system is computationally singular: reciprocal condition number = 1e-18 If you are really only interested in small matrices, then calculation of the condition number as the ratio of largest to smallest singular values is the most reliable thing to do (or you could just trap the `solve' errors). See e.g. Golub and van Loan "Matrix Computations" for efficient condition number estimators, for larger matrices. Simon> > but this seems doesnot work to prevent the singularity when inverting a > matrix. I am some confused about the relationship between "reciprocal > condition number" and determinant. Can anybody give me some idea how to > prevent this situation? > > Thanks a lot! > > Xiaohui > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > 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.--> Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK > +44 1225 386603 www.maths.bath.ac.uk/~sw283