Flip a Coin
Pro: Easy to use
Con: Could lead to unbalanced groups over short time period
## t
## 0 1
## 57 43
trial<- data.frame(
id=c(1:100),
r= runif(100,0,1)
)
trial$treat<-ifelse(trial$r>0.5, "treatment", "placebo")
w=table(trial$treat)
w##
## placebo treatment
## 49 51
Randomize blocks of specific size, so the treatment size are balanced.
Block of size 2 and 4 (AB,AABB,BA,BABA,ABBA…)
-Tool: psych: block.random
##
## 1 2
## 50 50
Randomize within specific strata to ensure that we have equal numbers of treated and untreated subjects in each stratum (age, histology)
Note: Strata is done in each site
age1 = blockrand(n = 50, id.prefix = "M", block.prefix = "M", stratum = "<=60")
age2 = blockrand(n = 50, id.prefix = "M", block.prefix = "M", stratum = ">60")
random_age = rbind(age1, age2)
table(random_age$treatment)##
## A B
## 51 51
## random_age$treatment
## random_age$stratum A B
## <=60 26 26
## >60 25 25
Reference:
Havard Catalyst
https://www.rpubs.com/mhanauer/464752
https://personality-project.org/revelle/syllabi/205/block.randomization.pdf