Dear R developers,

In my opinion, I discovered a severe flaw that occur with the combination of 
the Marsaglia-Multicarry pseudo-random number generator associated to the 
Kinderman-Ramage algorithm to generate normally distributed numbers.


The sample program is very simple (tested on R-4.1.1 x86_64 on Windows 10):

set.seed(1, "Marsaglia-Multicarry", normal.kind="Kinderman-Ramage")
v=rnorm(1e7)
poisson.test(sum(v < (-4)))$conf.int # returns c(34.5, 62.5)
poisson.test(sum(v > (4)))$conf.int # returns c(334.2, 410.7)
pnorm(-4)*1e7 # returns 316.7


There should be approximatively 316 values less than -4 and 316 values greater 
than +4, bug there are far too few values less than -4.

Results are similar with other random seeds, and things are even more obvious 
with larger sample sizes.

The Kinderman-Ramage algorithm is fine when combined to Mersenne-Twister, and 
Marsaglia-Multicarry is fine when combined with the normal.kind="Inversion" 
algorithm, but the combination of Marsaglia-Multicarry and Kinderman-Ramage 
seems to have severe flaws.

R should at least warn for that combination !

What do you think? Should I file a bug report?

--
Sincerely
Andr� GILLIBERT

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to