Statalist The Stata Listserver


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

Re: st: Sample size assignment


From   "Svend Juul" <SJ@SOCI.AU.DK>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Sample size assignment
Date   Sat, 30 Sep 2006 10:46:41 +0200

Shihe Fan wrote:
 
Could any one help me out on the following problem of producing a list
of random numbers for random assignment to groups? 
 
I want to produce a list of random numbers (total sample size =1000) for
random assignment to subgroups as listed below. How should I code this
in STATA (run Graziano and Raulin's random number generator program
repeatedly will achieve this. But it will be tedious because my real
problem is much bigger than this dummy problem)
 
Group  sub-group sample
1 1  x
1 2  x
1 3  x
1 4  x
1 5  x
2 1  x
2 2  x
2 3  x
2 4  x
2 5  x
...
5 1  x
5 2  x
5 3  x
5 4  x
5 5  x
Total   1000

The xs are random numbers.
--------------------------------------------------------------------
 
Your question is not very clear to me. 
 
Do you have a thousand individuals that you want to allocate randomly to five subgroups (treatments)? In that case:
   gen subgroup=ceil(5*uniform())
 
But you write that the xs are random numbers. Do you want to create 25 integers that are random and have the sum of 1000? (If yes, why?). 
 
I think you need to be more explicit about what you need.
 
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, work:  +45 8942 6090 
Phone, home:  +45 8693 7796 
Fax:          +45 8613 1580 
E-mail:       sj@soci.au.dk 
_________________________________________________________ 

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index