[R] singular matrix
Bill.Venables at csiro.au
Bill.Venables at csiro.au
Tue Aug 29 05:36:10 CEST 2006
Nongluck Klibbua reports:
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Nongluck
> Klibbua
> Sent: Tuesday, 29 August 2006 11:12 AM
> To: R-help at stat.math.ethz.ch
> Subject: [R] singular matrix
>
> Dear R-users,
> I try to use "solve" to get the solution of this matrix.But it has
error
> happen below.
> How I can solve this problem.
> [1] "a"
> [,1]
> [1,] 0.8109437
> [2,] 5.7569740
> [1] "b"
> [,1] [,2]
> [1,] 0.3141293 2.230037
> [2,] 2.2300367 15.831264
>
> Error in solve.default(b, a) : system is computationally singular:
> reciprocal condition number = 1.37415e-018
The irony seems to be that if you quote them to only this number of
digits then the system is no longer quite singular enough for the
problem to appear, at least on Windows R 2.3.1:
> a
[,1]
[1,] 0.8109437
[2,] 5.7569740
> b
[,1] [,2]
[1,] 0.3141293 2.230037
[2,] 2.2300367 15.831264
> solve(b, a)
[,1]
[1,] 2.5831242104
[2,] -0.0002203103
> b %*% solve(b, a) - a ### check
[,1]
[1,] -1.110223e-16
[2,] -8.881784e-16
In general, though, in dealing with singular systems you might want to
look at the function ginv in the MASS library.
More information about the R-help
mailing list