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

Re: st: Drawing multiple samples from a normal distribution


From   Richard Williams <[email protected]>
To   [email protected]
Subject   Re: st: Drawing multiple samples from a normal distribution
Date   Tue, 21 Dec 2004 11:48:26 -0500

At 11:12 AM 12/21/2004 -0500, Joseph Cordes wrote:
Actually, because we don't want them to actually know the "true" means and SDs we are going to generate the samples ourselves. Do I understand you correctly to say that each time we make a draw we need to provide a different seed? And if the answer is yes, am I correct in assuming that the seed can be any number chosen?
Here is another variation that might meet your needs, depending on exactly what you want:

forval i = 1/25 {
clear
set obs 100
set seed `i'
drawnorm sample`i', m(25) sd(5)
save sample`i'
}

That will give you 25 different samples. I like my earlier variation where everybody has access to all the data but maybe you don't want that.

With setting seeds, you want to be careful that (a) you don't draw the exact same samples when you don't want to. For example, if you just gave people commands to draw the sample themselves, then if they all gave those exact same commands immediately after starting Stata, then I believe they would all generate the same sample. (b) However, once people start varying in their commands, then the seeds start changing around, and then you get the problem that you may not be able to reproduce something because you don't know what the seed was. Setting the seed yourself (using different but known values) helps to avoid such problems.



-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc

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