Statalist


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

Re: st: RE: Random seed revisited 2- how to get random seeds more


From   wgould@stata.com (William Gould, StataCorp LP)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Random seed revisited 2- how to get random seeds more
Date   Thu, 02 Oct 2008 14:55:43 -0500

Tiago V. Pereira <tiago.pereira@incor.usp.br>, in response to my previous 
response to his question on resetting the random number seed, writes, 

> I thought it would be appropriate to add "a new pseudo-seed" inside 
> the loop because I need to do a loop, say, with 1000 replications, 
> in which each replication has then it own 1000 replications (e.g. 
> a loop inside a loop).  [...] That´s why my message is "how to get 
> random seeds more efficiently?".  Any other suggestions?

In my previously repsonse I addressed exactly that issue.  Stripped 
of explanation, the operational advice was (1) set the seed once outside 
of all loops, (2) do *NOT* reset the seed inside the inner loop, and 
(3) if you wish to be able to reproduce individual inner results 
in isolation, include -display "`c(seed)'"- at the top of the inner loop.

-- Bill
wgould@stata.com
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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