Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Sample question -- can't replicate my results from my laptop to desktop eventhough I set seed


From   "Svend Juul" <[email protected]>
To   <[email protected]>
Subject   Re: st: Sample question -- can't replicate my results from my laptop to desktop eventhough I set seed
Date   Thu, 22 Mar 2007 09:45:52 +0100

Anna wrote:

I drew a sample on my laptop using the following commands:

set seed  123456789
preserve
keep if iconst==1  /*sampling only construction sites*/
sample 30, count

I run my code on my desktop and I am getting different sites selected.

Any advice how to replicate it?

---------------------------------------------------------

If the datasets on your two computers are sorted differently, different
observations may be sampled. Look at these results:

sysuse auto.dta, clear
set seed 12345
sort weight
sample 10, count
summarize price

sysuse auto.dta, clear
set seed 12345
sort displacement
sample 10, count
summarize price

Hope this helps

Svend
__________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone: +45 8942 6090
Home:  +45 8693 7796
Email: [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/



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