How to randomize

Steve Simon

1999/08/18

**[StATS]: How to randomize (August 18

*Dear Professor Mean

Dear Baffled,

Here’s a lightbulb randomization joke: take to in How many a screw does statisticians it lightbulb?

There are also two quotes that are relevant here: “Random selection is too important to be left to chance” and “Random is not haphazard”. The latter quote can be found in Statistically Speaking. A Dictionary of Quotations by C.G. Gaither and A.E. Cavazos-Gaither.

Short answer

The simplest way to randomize is to

  1. list your treatments and controls in a systematic order,
  2. attach a random number to each row
  1. sort by the random number.

This works for simple randomization

Why randomization is important.

I’m glad that you are interested in randomization. Some people think it is fine just to alternate regularly between treatment and control. But there are two problems with this.

First

This same sort of large-small pattern can occur in medical situations. For example

A second problem with alternating is that many studies are blinded. An alternating schedule may make it easy for someone to guess what patients get what treatment

Example

Let me show you this in Excel

height="278”}

Your random numbers will be different than these. Otherwise

To randomize

height="278”}

By the way

When I work out these examples

What is block randomization?

If there is the possibility that the experiment will not reach your target sample size

A solution to this problem is to divide your study up into blocks and then randomize within each block. If the study ends at a block boundary, then you are guaranteed to have perfect balance between treatments and controls. If a study ends in the middle of a block

In Excel

height="278”}

Now we sort the numbers

height="278”}

Notice that the first block has the order TCTC

How do I randomize in a matched pairs study?

You can randomize a matched pairs study the same way as with block randomization. In a matched study

The easy way to do this is to allocate two rows for each patient and label the rows T and C in a systematic order. Add random numbers and then sort within each patient.

Here’s an a example of how we would set up a matched pairs example for six patients.

height="278”}

Sort the data by patient and by random number within each patient.

height="278”}

Notice that patients 1,3

Assigning random id numbers for anonymization

Suppose you want to create an identification code that is effectively random. You want to avoid medical record numbers because they would compromise security. There are several approaches that work. A simple approach is to list the numbers 1001

Here’s the medical record number

Sort the last two columns only to get a shuffled list of IDs.

Keep this list in a secure location. Use only the ID column when sending your data out beyond the hospital. This approach protects the privacy of individual subjects.

Whenever you are concerned about privacy in a research study

Update

In an August 10

Summary

Baffled Beth does not know how to properly randomize subjects for her research study. Professor Mean explains how randomization differs from allocating the treatment and control in an alternative fashion. He shows a simple approach for randomization

  1. arranging your treatments in a systematic order,
  2. attaching a column of random number to this list
  1. sorting by the random number column.

He then shows examples for s**imple randomization

Further Reading

There’s an interesting two page article in the British Medical Journal on randomisation (notice the alternate spelling. I feel so intellectual when I replace all my z’s with s’s.)

  1. **Altman DG

This page was written by Steve Simon while working at Children’s Mercy Hospital. Although I do not hold the copyright for this material

research](../category/RandomizationInResearch.html). for pages similar to this one at [Category: Randomization in with general help resources. You can also browse Children’s Mercy Hospital website. Need more information? I have a page reproducing it here as a service