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

Re: st: Query on -set seed-


From   Roger Newson <[email protected]>
To   [email protected]
Subject   Re: st: Query on -set seed-
Date   Tue, 08 Feb 2005 16:36:21 +0000

Thanks to Bill Gould for his extremely prompt and extremely helpful reply to my extremely obscure technical query. It might also be a good idea to make Stata issue an error message when the user sets a negative seed, as in

. set seed -999999999

and thereby protect even the very ingenious fools from their own stupidity. (Stata 8.2 already issues an error message for missing seeds.)

Best wishes

Roger


At 14:14 08/02/2005, you wrote:

Roger Newson <[email protected]> asked what happens if you -set seed- to
a number larger than 2^31-1, the documented maximum value of the seed.  He
suspects a bug and he is right.

I have reviewed the code:

    1.  The value of the seed is set to memory junk; said differently,
        a 4-byte area of memory containing the random-number
        seed is left uninitialized.  You type -set seed <x>-,
        <x> > 2^31-1, and it does not matter what number you type,
        the value of the seed will be memory junk.

    2.  Memory junk is as good as any other seed, randomnumberwise.

    3.  However, memory junk is not reproducible.  Type -set seed <x>-
        later, specifying the same value for <x> > 2^31-1, and the
        4-byte area that contains the seed will be left uninitialized
        again.  Perhaps, since the last time you set the seed, something
        unrelated was rewritten in that area, or perhaps the area still
        contains the same value.  In the latter case, you will be fooled
        into thinking the the -set seed- is reproducible.

We will treat this as a bug.  In the future, Stata will issue an error
message when you attempt to set a seed greater than 2^31-1.

-- Bill
[email protected]
*
*   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/

--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
  or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]
Website: http://phs.kcl.ac.uk/rogernewson/

Opinions expressed are those of the author, not the institution.

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