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

st: problem with swor and by


From   Gabriel Demombynes <[email protected]>
To   [email protected]
Subject   st: problem with swor and by
Date   Mon, 20 Dec 2004 02:16:54 -0800 (PST)

I'm using the user-written command swor to draw random
samples with 
replacement. I've discovered that even when I've set
the seed, the 
command does not always draw the same samples in
repeated runs when 
using by. It does not have this problem when not using
by. 

When I do the following, I get different results each
time I run the 
program:

set seed 6662
use alldata, clear
swor 1, gen(select) by(sex)
li

The problem seems to be particular to the variables in
my dataset. 
When I create a new group variable, e.g. assigning
group=1 for the 
first half of the observations, and group=2 for the
second half, and 
then run the analysis by(group) there's no problem; I
can reproduce the same results on multiple draws.
But the problem 
persists even when I create a new group variable based
on a pre-
existing variable and use that, e.g. 

set seed 6662
use alldata, clear
gen group=1 if sex==1
replace group=2 if sex==2
swor 1, gen(select) by(group)
li
 
I've looked at the swor ado file, but I can't figure
out what might 
be wrong. Any suggestions?

Gabriel




		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less. 
http://info.mail.yahoo.com/mail_250
*
*   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