-- Paul Silcocks
> Has anyone found a way of incorporating the Mersenne Twister
> pseudo-random number generator into Stata? There is freeware
> C++ code at
> http://www.bedaux.net/mtrand/ but I'm not clear how this could be
> adapted into an ado file. What would be nice would be a new version
> of uniform(). Stata technical support recommend using Mata as it is
> closer in syntax to C++ than the Stata ado language (though this
> doesn't help me much as I've not got to grips with Mata).
-- Nick Cox
> Why do you feel there is a need for a new version of -uniform()-?
-- Silcocks Paul
> My understanding is that this method is fast, passes appropriate tests
> and has a huge period (2^19937 -1), much greater than Stata's KISS
> generator.
Tech support was right, translating C to Mata is much much easier
than translating it to ado. If you understand the C code you can
quickly learn the necessary Mata. If you don't understand the C
code, you won't be able to translate it into any language anyhow.
Furthermore, if speed is a requirement than Mata definitely has
an advantage over ado.
You might find the following column by Bill Gould helpful:
W. Gould (2005), "Mata matters: Translating Fortran", The Stata
Journal, 5(3), pp 421-441.
Hope this helps,
Maarten
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
*
* 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/