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

st: RE: -set seed-, _uniform(), with -preserve-


From   "Steichen, Thomas" <[email protected]>
To   <[email protected]>
Subject   st: RE: -set seed-, _uniform(), with -preserve-
Date   Mon, 28 Oct 2002 09:04:30 -0500

Stephen P. Jenkins writes (in part):
> 
> According to User Guide [U], page 118, "uniform() gives the same 
> sequence of random numbers in every Stata session (measured from the 
> start of the session) unless you reinitialize the seed."
> Does the use of -preserve- count as a new session?

No, but using the random number generator moves you along the given
sequence of random numbers to be generated (the seed specifies which
sequence of random numbers you will get), so if you generate 
random numbers between the -set seed- and the -preserve-, you will
move along that sequence and (correctly) get different numbers when 
generating after the -preserve- compared to those you would get had 
you not already used some of that sequence before the -preserve-.

Resetting the seed starts you at the front of the sequence again...
it does not "account" for the -preserve-, instead it accounts for the
random numbers already removed from the given sequence by the first
-generate- command.

Tom  
CONFIDENTIALITY NOTE:  This e-mail message, including any attachment(s), contains information that may be confidential, protected by the attorney-client or other legal privileges, and/or proprietary non-public information.  If you are not an intended recipient of this message or an authorized assistant to an intended recipient, please notify the sender by replying to this message and then delete it from your system.  Use, dissemination, distribution, or reproduction of this message and/or any of its attachments (if any) by unintended recipients is not authorized and may be unlawful.




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