Skip to content

Ubuntu and R

15 messages · Tyler Smith, Fernando Mayer, Clint Harshaw +9 more

#
You could try the stable/sarge backport from Cran. That's less likely 
to cause problems than using the Etch version, but I'm not using Ubuntu 
so I can't confirm this. Add the following to your sources.list and see 
how it goes:

     deb http://cran.R-project.org/bin/linux/debian stable/
#
I did this in my Ubuntu 5.10 and it works very well...

Fernando Mayer.

Tyler Smith escreveu:
#
Thanks for the advice, everyone. I've done what Tyler suggested and have 
a fresh install of R now using the Debian binaries.

Clint
Fernando Mayer wrote:
#
Hi All,

An annoying but not critical problem I am having is that the variance of
a vector of constants is reported as > 0. I imagine there is a simple
workaround for the following but could not find it after having spent an
embarrassing amount of time.

In Splus:
In R:

x<-rep(0.02,10)
var(x)
1.337451e-35

I assumed the problem had to do with machine precision and suitably
modified .Machine$double.eps and .Machine$double.neg.eps which I thought
would fix the problem but without success. Any pointers to a solution
would be appreciated!

Cheers,
Barry Zajdlik
#
On Thursday 16 February 2006 11:29, Barry Zajdlik wrote:
Well, its nearly zero ;-)

JD
#
Could you please provide "sessionInfo()";  I can't replicate the 
problem:

 > var(x)
[1] 0
 > sessionInfo()
R version 2.2.1, 2005-12-20, i386-pc-mingw32

attached base packages:
[1] "methods"   "stats"     "graphics"  "grDevices" "utils"     "datasets"
[7] "base"

	  spencer graves
Barry Zajdlik wrote:

            
#
Barry Zajdlik wrote:

            
Which version of R and which OS is this? I get 0 for both Linux and 
Windows with R-2.2.1.
Anyway, 0.02 is not well representable and hence can be very well the 
cause for such a numerical inaccuracy.
Changing .Machine$double.eps does not help to calculate more accurate ...

Uwe Ligges
#
This looks like the known problem, PR#1228.

It is possible to do better, but really users should be aware that 
numerical inaccuracies will occur, and not expect exact results from 
floating-point calculations.
On Thu, 16 Feb 2006, Uwe Ligges wrote:

            

  
    
#
On 16 Feb 2006, at 23:17, Uwe Ligges wrote:

            
--
Jari Oksanen, Oulu, Finland
#
Hello all,

Thanks for the responses but I am still annoyed by this seemingly simple
problem; I recorded sessionInfo() as below.

x<-rep(0.02,10)
[1] 1.337451e-35
R version 2.1.0, 2005-04-18, i386-pc-mingw32 

attached base packages:
[1] "methods"   "stats"     "graphics"  "grDevices" "utils"
"datasets" 
[7] "base"
I then decided to download the latest version today but obtained the
same result.
[1] 1.337451e-35
R version 2.2.1, 2005-12-20, i386-pc-mingw32 

attached base packages:
[1] "methods"   "stats"     "graphics"  "grDevices" "utils"
"datasets" 
[7] "base"    


I Changed .Machine$double.eps to make the calculations LESS accurate.
My thought was that if I reduced the precision, 1-eps would return 1
instead of some number less than 1.  My thought was that if eps were
sufficiently large my sample problem would return a zero.  This didn't
happen though.

Again, any thoughts would be appreciated.

Regards,
Barry Zajdlik
#
Barry,
Try the latest _patched_ version. I'm on 2006-02-12, but that may
already be superseded. I get var(x) = 0.

Peter Ehlers
Barry Zajdlik wrote:
#
On Fri, 17 Feb 2006, Barry Zajdlik wrote:
Well, yes, it is accurate only to 35 digits and this is a bit unfortunate 
since it could be more accurate in this case. The exact result is probably 
system-dependent, but there has been a bug report for a long time 
(PR#1228) that var() is not as accurate as it could possibly be, and 
patches would be welcome.  They obviously aren't a very high priority for 
anyone.
.Machine is a set of constants that describe your hardware and C 
implementation.  They are right when you start. If you change them all 
that happens is that they become wrong -- R doesn't go in and re-engineer 
the floating point hardware.

 	-thomas
#
On 2/17/2006 1:17 PM, Barry Zajdlik wrote:
My guess is that you've got a video driver or some other software that's 
messing with your floating point processor, reducing the precision from 
64 bit to 53 or less.  I can reproduce the error after running 
RSiteSearch, which messes with my fpu in that way:

 > var(rep(0.2, 100))
[1] 0
 > RSiteSearch('fpu')
A search query has been submitted to http://search.r-project.org
The results page should open in your browser shortly
 > var(rep(0.2, 100))
[1] 1.525181e-31

(I'm not blaming RSiteSearch for doing something bad, it's the system 
DLLs that it calls that are at fault.)

I think this is something we should address, but it's not easy.

Duncan Murdoch
#
I got the same thing as Duncan:

 > var(rep(0.2, 100))
[1] 0
 > RSiteSearch('fpu')
A search query has been submitted to http://search.r-project.org
The results page should open in your browser shortly
 > var(rep(0.2, 100))
[1] 1.525181e-31
 > sessionInfo()
R version 2.2.1, 2005-12-20, i386-pc-mingw32

attached base packages:
[1] "methods"   "stats"     "graphics"  "grDevices" "utils"     "datasets"
[7] "base"

	  spencer graves
Duncan Murdoch wrote:

            
#
Note though that this is already giving 0 in both cases in R-devel on 
Windows (the only platform on which this difference occurs).
On Sat, 18 Feb 2006, Spencer Graves wrote: