Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: RE: Random number generator


From   "Maarten Buis" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: Random number generator
Date   Thu, 23 Aug 2007 13:56:11 +0200

-- 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/



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