From @ndre @end|ng |rom g||||bert@|r  Fri Aug 13 13:26:43 2021
From: @ndre @end|ng |rom g||||bert@|r (=?UTF-8?Q?Andr=c3=a9_GILLIBERT?=)
Date: Fri, 13 Aug 2021 13:26:43 +0200
Subject: [Rd] ,
 Problem in random number generation for Marsaglia-Multicarry +,
 Kinderman-Ramage
In-Reply-To: <0EB03E15-B535-4D78-98D0-6A73E224235A@gmail.com>
References: <54745780b6c1421298e55e1e8c18d6ab@chu-rouen.fr>
 <0EB03E15-B535-4D78-98D0-6A73E224235A@gmail.com>
Message-ID: <50bb3316-7510-d301-abf6-4aa88c4182e8@gillibert.fr>

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
 >



[Rd] , Problem in random number generation for Marsaglia-Multicarry +, Kinderman-Ramage
=?UTF-8?Q?Andr=c3=a9_GILLIBERT?=