[R] Mean calculated from R1.9.1 different from R2.0.1

Campbell p.campbell at econ.bbk.ac.uk
Thu Feb 10 13:28:00 CET 2005


This may or may not be related, but looking at the random number
generators in Numerical Recipies In C book it would appear that random
number generators with identical seeds will give different results 
depending upon whther they are compliled with 64 bit or 32 bit 
settings.


Is this the case with the random number generators in R?

Phineas Campbell


 

>>> Chang-Heok Soh <csoh at hsph.harvard.edu> 02/10/05 8:44 AM >>>
Hello,
I ran my simulations on the Unix verson of R1.9.1 and the Windows
version
of R2.0.1 on XP.  I kept getting different values for the mean of the
same
column of the same matrix, and am perplexed.  I would appreciate if
anyone
could help explain the difference?

Here is a sample code:

set.seed(7293)
z1v <- rnorm(1000, mean=68, sd=13)
z1v <- (z1v-mean(z1v))/sd(z1v)

Using R1.9.1 on Unix, I get:

mean(z1v)
[1] -4.88775e-15

Using R2.0.1 on Windows XP, I get:

mean(z1v)
[1] -3.7497e-16

The same problem occurs when I dump the data from one version and
then source it using the other version.

Thanks for the help.

Regards,
Chang-Heok

______________________________________________
R-help at 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




More information about the R-help mailing list