Re: [R] Matrix Inversion

From: Robin Hankin <r.hankin_at_noc.soton.ac.uk>
Date: Wed, 12 Dec 2007 11:13:06 +0000

Hello Wang

matrix bb is symmetric positive semidefinite, so algebraically the eigenvalues are nonnegative.

I would use

bb <- crossprod(b)

to calculate bb (faster and possibly more accurate)

Look at eigen(bb,TRUE,TRUE)$values

(see ?eigen for the meaning of the arguments) to see how many very small eigenvalues you have. The number of zero eigenvalues is equal to the number of linear relations in the columns of b.

HTH rksh

On 12 Dec 2007, at 10:59, Wang Chengbin wrote:

> I got the following error:
>
> a = read.csv("mat.csv")
> b = as.matrix(a)
> tb = t(b)
> bb = tb %*% b
> dim(bb)
> ibb = solve(bb)
> bb %*% ibb
>
>> ibb = solve(bb)
> Error in solve.default(bb) :
> system is computationally singular: reciprocal condition number =
> 1.77573e-19
>>
> Are there any ways to find more information about why it is singular?
>
> Thanks.
> ______________________________________________
> R-help_at_r-project.org 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.

--
Robin Hankin
Uncertainty Analyst and Neutral Theorist,
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

______________________________________________
R-help_at_r-project.org 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.
Received on Wed 12 Dec 2007 - 11:19:22 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 12 Dec 2007 - 11:30:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.