Randomization of Intervention-control Pairs
Menu location: Analysis_Randomization_Intervention-control Pairs
This function provides random allocation into intervention or control arms of a trial for a paired/matched experimental design. Each subject will experience both intervention and control treatment at some stage during the trial, the paired randomization determines the treatment order.
Randomization reduces opportunities for bias and confounding in experimental designs, and leads to treatment groups which are random samples of the population sampled, thus helping to meet assumptions of subsequent statistical analysis (Bland, 2000). A particular bias in this design might be intervention having some carry-over effect on control treatment.
Example: randomization of 50 patients into treatment (intervention) and placebo (control) arms of a trial of a new drug. This would give 50 pairs of INTERVENTION - CONTROL or CONTROL - INTERVENTION. If this was a randomized crossover study then you would give drug first if the order was INTERVENTION - CONTROL and you would give placebo first if the order was CONTROL - INTERVENTION.
To reproduce this allocation in StatsDirect select Intervention-control Pairs from the Randomization section of the Analysis menu, enter 50 as the number of pairs, enter 10 as the seed and answer yes to 'Try balanced allocation'. A seed gives the same allocation each time it is used; leave it blank for a seed taken from the clock. Balanced allocation gives each order to exactly half of the pairs, in a random arrangement, and needs an even number of pairs; without it (or with an odd number of pairs) each pair's order is decided independently with an equal chance of either, and the report's heading then shows the seed alone.
For this example:
Randomized intervention-control pairs
Randomized with seed: 10, balanced allocation
| 1 | Intervention - Control |
| 2 | Control - Intervention |
| 3 | Intervention - Control |
| 4 | Intervention - Control |
| 5 | Control - Intervention |
| 6 | Control - Intervention |
| 7 | Intervention - Control |
| 8 | Control - Intervention |
| 9 | Intervention - Control |
| 10 | Control - Intervention |
| 11 | Intervention - Control |
| 12 | Control - Intervention |
| 13 | Control - Intervention |
| 14 | Intervention - Control |
| 15 | Intervention - Control |
| 16 | Intervention - Control |
| 17 | Control - Intervention |
| 18 | Control - Intervention |
| 19 | Intervention - Control |
| 20 | Control - Intervention |
| 21 | Intervention - Control |
| 22 | Control - Intervention |
| 23 | Control - Intervention |
| 24 | Intervention - Control |
| 25 | Control - Intervention |
| 26 | Control - Intervention |
| 27 | Control - Intervention |
| 28 | Intervention - Control |
| 29 | Intervention - Control |
| 30 | Intervention - Control |
| 31 | Intervention - Control |
| 32 | Intervention - Control |
| 33 | Intervention - Control |
| 34 | Control - Intervention |
| 35 | Control - Intervention |
| 36 | Intervention - Control |
| 37 | Intervention - Control |
| 38 | Control - Intervention |
| 39 | Control - Intervention |
| 40 | Control - Intervention |
| 41 | Control - Intervention |
| 42 | Intervention - Control |
| 43 | Control - Intervention |
| 44 | Control - Intervention |
| 45 | Intervention - Control |
| 46 | Intervention - Control |
| 47 | Control - Intervention |
| 48 | Control - Intervention |
| 49 | Intervention - Control |
| 50 | Intervention - Control |
Technical validation
Robust (pseudo-)random number generation is used, see random number generation.
R code
This R code reproduces the illustration above with R's own random number generator, so the same seed gives a different arrangement of the pairs. It needs no packages and was checked with R 4.6.1. Paste it into R, or save it as a script and run it.
# Randomization of intervention-control pairs: the StatsDirect help example (50
# patients, each given both treatments, allocated to the order intervention then
# control or control then intervention, seed 10, balanced allocation) in R
pairs <- 50
seed <- 10
orders <- c("Intervention - Control", "Control - Intervention")
# StatsDirect and R each have their own random number generator, so the same seed
# gives a different sequence in each program: this script repeats its own
# allocation every time it is run, but it does not repeat the table above.
# Balanced allocation gives each order to exactly half of the pairs (so the
# number of pairs must be even) in a random arrangement: sample() without
# replacement returns the 25 copies of each order in a random permutation.
set.seed(seed)
balanced <- sample(rep(orders, pairs / 2))
cat("Randomized intervention-control pairs\n")
cat(paste0("Randomized with seed: ", seed, ", balanced allocation"), "\n")
print(data.frame(pair = seq_len(pairs), order = balanced), row.names = FALSE)
cat("Pairs allocated Intervention - Control =", sum(balanced == orders[1]), "\n")
cat("Pairs allocated Control - Intervention =", sum(balanced == orders[2]), "\n")
# Every arrangement of 25 of each order is equally likely: there are choose(50, 25)
cat("Equally likely balanced arrangements =",
formatC(choose(pairs, pairs / 2), format = "f", digits = 0), "\n")
# Without balancing, each pair's order is decided independently, like a coin
# toss, so the two orders need not be equally frequent (with this seed they happen
# to be): sample() with replacement
set.seed(seed)
tossed <- sample(orders, pairs, replace = TRUE)
cat("Unbalanced: Intervention - Control =", sum(tossed == orders[1]),
" Control - Intervention =", sum(tossed == orders[2]), "\n")