StATS: An inefficient approach to randomization (August 10, 2005)

Someone figured out how to prepare a randomization table on their own and it works reasonably well, but still has a few problems. She used the randbetween(1,2) function to randomly select either 1 or 2 with 50% probability. That works nicely up to a point, but at the end of the 400 rows, the total number of 1's was 223 and the total number of 2's was 177. When you flip a coin 400 times, the distribution of heads and tails is random, but there is no guarantee that the number of heads will be exactly 200. The same problem applies to the randbetween() function.

If you can live with a final disparity of sample sizes, then this approach works fine. It is better though, to create a list in a systematic order (1, 2, 1, 2, 1, 2, ...) and then attach a column of random numbers (=rand()). sort both columns by the column of random numbers and that effectively puts the first column in a random order.

This page was written by Steve Simon while working at Children's Mercy Hospital. Although I do not hold the copyright for this material, I am reproducing it here as a service, as it is no longer available on the Children's Mercy Hospital website. Need more information? I have a page with general help resources. You can also browse for pages similar to this one at Category: Randomized trials.