逆矩阵中的错误

Error in the matrix Inverse

我有协方差矩阵的估计值

我想取这个矩阵的逆,R给我如下错误

A=[ 3529861.470  8785861.47  6920.344 17120.34;
     8785861.470 26209861.47 17120.344 51920.34;
    6920.344    17120.34    14.000    34.00;
    17120.344    51920.34    34.000   104.00]

"Error in solve.default(l) : system is computationally singular: reciprocal condition number = 2.14511e-22".

然而Matlab在没有给出任何错误信息的情况下进行了逆向计算。有谁知道 R 给我错误的原因?是计算逆的任何其他方法

A <- matrix(c(3529861.470,8785861.47,6920.344,17120.34,
       8785861.470,26209861.47,17120.344,51920.34,
   6920.344,17120.34,14.000,34.00,
   17120.344,51920.34,34.000,104.00),
     nrow=4,byrow=TRUE)

solve(A) ## works on my system

##              [,1]         [,2]         [,3]        [,4]
## [1,]   -1.2515442    0.7617239     535.4871   -349.3141
## [2,]    0.7617072   -0.4635922    -325.9051    212.5957
## [3,]  535.4884664 -325.9130639 -229114.3516 149458.2734
## [4,] -349.3061387  212.5955306  149454.4973 -97492.7335

eigen(A)$values
## [1]  2.921525e+07  5.245875e+05  1.440703e+00 -3.061760e-06

rcond(A)  ## condition number
## [1] 7.516179e-14

如果您在求逆矩阵时遇到问题,您应该能够调整 tol 参数,但这当然需要您自担风险——您忽略了矩阵运算可能会带来的警告数值不稳定。

这是

R Under development (unstable) (2015-02-11 r67792)
Platform: i686-pc-linux-gnu (32-bit)
Running under: Ubuntu precise (12.04.5 LTS)