On Wed, 11 Jun 2003, Wolfgang Viechtbauer wrote:
> Dear All,
>
> The editor of a journal to which I had submitted a publication asked
> whether R has a "tested random number generator." My paper
included
> Monte Carlo simulations generating random normal and random chi-square
> values.
>
> help(rnorm) lists
>
> Wichura, M. J. (1988) Algorithm AS 241: The Percentage Points of
> the Normal Distribution. Applied Statistics, 37, 477-484.
>
> as a reference, but this algorithm does not discuss the generation of
> random values.
>
> help(RNG) indicates that the "Mersenne-Twister" is the default
random
> number generator with reference:
>
> Matsumoto, M. and Nishimura, T. (1998) Mersenne Twister: A
> 623-dimensionally equidistributed uniform pseudo-random number
> generator, ACM Transactions on Modeling and Computer Simulation,
> 8, 3-30.
>
> I looked at the paper, but essentially I have no expertise in assessing
> whether this random number generator is "good" (which is probably
a
> tricky concept in the first place when dealing with RNGs). I have almost
> blind faith in the developers of R (at least when it comes to something
> so fundamental as a RNG) that I feel confident that it is good, but I
> guess I need something more substantial at this point to back of my
> beliefs! Any suggestions on how I can "show" (without having to
go
> through a separate study just to make this claim) that the RNG is
> "tested"? Any references?
>
> Also, I am a little uncertain about how R generates random observations
> from various distributions, such as in rnorm() or rchisq(). Does it
> generate random uniforms u ~ U(0,1) and then solve for x in F(x) = u)? I
> would imagine that this is rather slow compared to other specialized
> methods for various distributions. Any information on this would be
> appreciated as well.
Try reading the appropriate help pages (or the code), which give
references. Also, don't imagine: check out your suppositions in the RNG
literature. (rnorm uses inversion by default, and it is not slow. Someone
here claimed that another method was `6 to 7 times faster', but on all bar
one of the machines I tried it was less than 1.5x faster and often slower.
I never received a reply giving evidence for the claim, so presume it was
false.)
> I guess some of this relates to the "Validation of R" discussion
that
> occured a while ago on this list, so this info could be of general
> interest.
There are many much-tested PRNGs that have been found to be seriously
deficient! Just point your editor at the reference and that R is
developed by people with international standing in that area, then ask
his/her credentials for assessing RNGs.
But first make sure you have followed standard advice and run your
simulations with at least two fundamentally different PRNGs.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595