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: "bsample" and "set seed" together do not work!


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: "bsample" and "set seed" together do not work!
Date   Fri, 17 Sep 2010 12:48:09 +0000 (GMT)

--- On Fri, 17/9/10, Daniele Pacifico wrote:
> I am working with the command "bsample"  and I
> discovered that the command "set seed #" stops 
> "bsample" from drawing different samples from
> my data.
>
> I had this problem because I am writing an ado file that
> sets a seed when it runs.. However, I discovered that the 
> seed I define within my ado file creates the problem I
> have shown you above (i.e. I cannot use bsample with the 
> command defined in my ado file).. Do you have any advise
> about it? How can I "unset" the seed so as to allow it to
> vary randomly again with bsample?

"Do not work" does not describe your situation very well: All 
programs work exactly as they should, i.e. they do what you 
told them to do (they may not do what you want them to do, 
but that is a different question).

You might be tempted to set the seed "randomly" inside your
loop before each -bsample- command, but that does not work 
well as Bill discussed here:
http://www.stata.com/statalist/archive/2010-08/msg00834.html

I just would avoid setting the seed inside a program. In 
general it sounds like bad practice to me. For one thing
you are this way overwriting any -set seed- commands your
user might issue before your command, thus leaving them
puzzled e.g. when they are trying to run a simulation using 
your command.

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------


      

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index