Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: inconsistent random numbers even using -set seed-


From   Maarten Buis <[email protected]>
To   [email protected]
Subject   Re: st: inconsistent random numbers even using -set seed-
Date   Wed, 22 Jan 2014 12:28:13 +0100

On Wed, Jan 22, 2014 at 12:02 PM, Seed, Paul wrote:
> After much trouble I found that the inconsistency depends on the sort order.
> The uniform() function is producing exactly the same set of pseudorandom
> numbers each time, and putting them into record 1, 2, 3, 4... as they are produced.
>
> However, sorting by rep78 is only a _partial_ sort.
> The order within each value of rep78 is determined arbitrarily by some
> internal Stata process, and changes each time. So record 1, 2, 3, 4... are
> not the same each time.

As far as I know this is intentional behaviour: The -sort- command
will intentionally sort observations with the same value randomly
(what else could it do?) and to protect you from incorrectly seeing
consistent results where none exist, it lets the underlying random
process be governed by a different seed. You can read more on this by
typing in Stata -help sortseed-.

Hope this helps,
Maarten

---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany

http://www.maartenbuis.nl
---------------------------------
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index