[Rd] , Problem in random number generation for Marsaglia-Multicarry +, Kinderman-Ramage

André GILLIBERT @ndre @end|ng |rom g||||bert@|r
Fri Aug 13 13:26:43 CEST 2021


Thank you.

It looks like the M-M generator is deeply flawed, although R 
implementation seems to be faithful.

I can understand that R keeps this generator for historical reasons.

However, R should at least warn that this generator is buggy and should 
not be used!

That could be as simple as a Warning message generated by set.seed().


-- 

Sincerely

André GILLIBERT


 > With these matters, one has to be careful to distinguish between 
method error and implementation error.
 > The reason for changing the RNG setup in R v. 1.7.0 was pretty much 
this kind of unfortunate interaction between M-M and K-R. There are even 
more egregious examples for the distribution of maxima of normal 
variables. Try e.g.
 >
 > RNGversion("1.6.0") # Marsaglia-Multicarry, Kinderman-Ramage
 >  s <- replicate(1e6,max(rnorm(10)))
 >  plot(density(s))
 >
 > (A further bug in K-R was fixed in 1.7.1, but that is tangential to 
this.)
 >
 > A glimpse of the source of the problem is seen in the 
"microcorrelations" in this:
  >
 > RNGkind("Mar");m <- matrix(runif(4e7),2)
 >  plot(m[1,],m[2,],xlim=c(0,1e-3),pch=".")
 >  m <- matrix(runif(4e7),2)
 >  points(m[1,],m[2,],pch=".")
 >
 > These examples are from 2003, so the issue has been known for almost 
2 decades. However, to the best of our knowledge, the M-M RNG is a 
faithful implementation of their > method, so we have left the RNG in 
R's arsenal, in case someone needed it for some specific purpose.
 >
 > - pd
 >



More information about the R-devel mailing list