[R] how to invert the matrix with quite small eigenvalues

From: huang min <minhuangr_at_gmail.com>
Date: Mon 30 May 2005 - 17:20:56 EST

Dear all,

I encounter some covariance matrix with quite small eigenvalues (around 1e-18), which are smaller than the machine precision. The dimension of my matrix is 17. Here I just fake some small matrix for illustration.

 a<-diag(c(rep(3,4),1e-18)) # a matrix with small eigenvalues
 b<-matrix(1:25,ncol=5) # define b to get an orthogonal matrix

 aah<-bb$vectors%*%diag(1/sqrt(diag(a)))  aa<-aah%*%t(aah) # aa should have the same eigenvalues as a and should be #invertable,however,

 solve(aa) # can not be solved
 solve(aa,tol=1e-19) # can be inverted, however, it is not symmetric and furthermore,
 solve(aa,tol=1e-19)%*%aa # deviate much from the identity matrix

I have already define aa to make sure it is symmetric. So the inverse should be symmetric.

Does the problem come from the rounding error since the eigenvalue is smaller than the machine precision? In fact, the eigenvalue of aa is negative now, but at least, it is still invertable. How can I get the inverse? Thanks.

R-help@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 Received on Mon May 30 17:31:23 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:15 EST