Re: [R] R accuracy

From: Uwe Ligges <ligges_at_statistik.uni-dortmund.de>
Date: Wed 23 Mar 2005 - 20:11:56 EST

Anthony Landrevie wrote:

> Hello,
>
> I am trying to test the precision of R on datasets from The Statistical Reference Datasets Project http://www.itl.nist.gov/div898/strd/index.html and I don't manage to understand how R is storing its results.
>
> For example, I calculate a mean on the michelso dataset (100 values) and find:
>
>

>>m=mean(michel)
>>m

>
> V1
> 299.8524
>
>>print(m,digits=15)

>
> V1
> 299.8524
>
>
>>print(m,digits=22)

>
> V1
> 299.85239999999993
>
>
> The certified value of the mean is 299.85240, so I try
>
>
>
>>print(m-299.8524)

>
> V1
> -5.684342e-14
>
>
>>print(m-299.8524,digits=15)

>
> V1
> -5.68434188608080e-14
>
> Does it have a sens to print with more than 15 signifiant digits?

Depends, e.g. you mightg want to see that the result is only -5.684342e-14 off, hence not identical() to, but all.equal() with what you expected.

> Why is the difference not equal to zero?

Floating point calculations on a digital computer are involved...

Uwe Ligges

> I am using R 2.0.1 under Windows XP.
>
> Regards,
>
> Anthony Landrevie
>
>
> ---------------------------------
>
>
> [[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



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 Wed Mar 23 20:15:26 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:55 EST