Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Stata vs. SAS (random number generation)


From   Joseph Coveney <jcoveney@bigplanet.com>
To   Statalist <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Stata vs. SAS (random number generation)
Date   Fri, 08 Apr 2005 18:16:43 +0900

JP Azevedo wrote:

Many thanks you all for the valuable comments and suggestions.

I did a little bit of more digging, and found out that the references on the
"pseudo-random number generator" on the Stata 8 manuals and the SAS 5
manuals are quite different.

While Stata talks about using George Marsalis (1994) 32-bits pseudo-random
number generator, SAS actually has two different functions RANUNI [Fishman
and Moore, 1982] and UNIFORM [Lewis, Goodman and Miller (1969) and Kennedy
and Gentle (1980)].

Unfortunately the SAS manuals did not present a section with the full
references, and the Stata one only said:

Marsaglia, G (1994). Personal communication

I would like to know if anyone familiar with this literature could advise me
how feasible it is to create a compatible pseudo-random number generator
which would be compatible across these two packages?

----------------------------------------------------------------------------

The Stata user manual does describe the algorithm in detail.  I guess that
Stata's manual cites the personal communication, because George Marsaglia
hadn't published his KISS generator at the time.  And apparently it still
hasn't been formally published:  a recent article* cites his 1999 posting to
sci.stat.math (which provides C source code and can be found archived at
www.cs.yorku.ca/~oz/marsaglia-rng.html among other places) to reference the
KISS generator.

SAS got slammed several years ago for its random number generator
( www.amstat.org/publications/tas/mccull-1.pdf and
www.amstat.org/publications/tas/mccull.pdf ) primarily because of the
inadequacy of its period length.  SAS Institute put out a rejoinder of sorts
( support.sas.com/rnd/app/papers/statisticalaccuracy.pdf ).  (SAS's JMP
offering has, however, switched to the Mersenne Twister.)  The Stata manual
states a period of ca. 2^126 for its generator.  Based upon this
consideration, if you wanted to use the straightforward method that Timothy
McKenna suggests, then Stata -> SAS would be the better direction, unless
SAS has since switched to a modern algorithm in its flagship product as
well.

If you wanted a statistical-package-neutral source of numbers to use in this
way, Professor Marsaglia's DIEHARD site at Florida State University held
downloadable sets of pseudorandom numbers.  That's gone, but there are
numerous other Web sites that offer pseudorandom number sets for
downloading, and a few with natural-origin random number sets.

Joseph Coveney

* Philip H.W. Leong, Guanglie Zhang, Dong-U Lee, Wayne Luk and John D.
Villasenor, A comment on the implementation of the Ziggurat method. _Journal
of Statistical Software_ Volume 12, Issue 7, February 2005.
www.jstatsoft.org/counter.php?id=114&url=v12/i07/v12i07.pdf&ct=1









*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index