[R] How to set the floating point precision beyond e-22?

From: Roy Nitze <rnitze_at_wiwi.uni-bielefeld.de>
Date: Fri 05 Aug 2005 - 18:44:18 EST


-----Ursprüngliche Nachricht-----
Von: Roy Nitze [mailto:rnitze@wiwi.uni-bielefeld.de] Gesendet: Freitag, 5. August 2005 10:38
An: 'r-help@stat.math.ethz.ch'
Betreff: How to set the floating point precision beyond e-22?

We have a problem inverting a matrix which has the following eigenvalues:  

> eigen(tcross, only.values=TRUE)

 [1]  7.917775e+20  2.130980e+16  7.961620e+13  8.241041e+12  2.258325e+12
 [6]  3.869428e+11  6.791041e+10  2.485352e+09  9.863098e+08  9.819373e+05

[11] 3.263408e+05 2.929853e+05 2.920419e+05 2.714355e+05 8.733435e+04
[16] 8.127136e+04 6.543883e+04 5.335074e+04 3.773311e+04 2.904373e+04
[21] 2.418297e+04 1.387422e+04 8.925090e+03 5.538344e+03 4.831908e+03
[26] 1.133571e+03 9.882477e+02 7.725812e+02 5.081682e+02 3.010545e+02
[31] 1.801611e+02 1.319787e+02 1.050521e+02 7.096471e+01 5.576549e+01
[36] 4.192645e+01 3.549810e+01 2.638731e+01 2.444429e+01 1.735139e+01
[41] 1.058796e+01 7.425778e+00 7.209576e+00 4.689665e+00 3.181650e+00
[46] 3.002956e+00 1.959247e+00 1.551665e+00 1.079589e+00 1.064981e+00
[51] 5.409617e-01 4.076501e-01 2.010129e-01 1.302394e-01 4.029787e-02
[56] 2.599448e-02 1.061294e-02 1.634286e-03 4.095303e-09 1.021885e-10
[61] 2.124763e-11 6.906665e-12 2.850103e-12 9.440867e-13 6.269723e-13
[66] 1.043794e-13 -1.300171e-13 -7.220665e-13 -4.166945e-12 -6.145350e-12
[71] -2.776804e-11 -5.269669e-11 -7.154246e-10 -1.490515e-09 -1.294256e-08
[76] -1.224821e-02 -3.278657e+00 -4.620100e+01 -9.781843e+02 -1.303929e+04
[81] -5.545949e+04 -8.077540e+04 -8.577861e+04 -1.329961e+05 -1.450908e+05
[86] -3.022353e+05 -4.015776e+05

As yout can see, the eigenvalues spread very much (between e+20 and e-13). We presume, that it has something to do with R's floating point precision, which I read is about 22-digits in mantissa as default. Can this precision be set to values above 22? The problem occurs especially when trying to perform 2SLS with the 'systemfit' package. There appears always an error message like the following from the inverting routine:  

Error in solve.default(tcross) : Lapack routine dgesv: system is exactly singular

Or is there another source of error? We would like to embed R-routines in a non-commercial web application for which we need to employ 'systemfit' together with individual, user-submitted data. So the problem needs a general solution and not a special one for this particular matrix.  

Thanks in advance

PS: The 'gmp' package is definitely not the solution. I already tried it.

        [[alternative HTML version deleted]]

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 Fri Aug 05 18:51:00 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:05:29 EST