User Tools

Site Tools


r-permuted-block-randomization

This is an old revision of the document!


A PCRE internal error occured. This might be caused by a faulty plugin

The code below generates a permuted-block (block size is two) randomization of 200 participants to two arms in equal proportion, and plots the empirical proportion of participants in each arm as they are recruited. <code> interleave <- function(v1,v2) { ord1 <- 2*(1:length(v1))-1 ord2 <- 2*(1:length(v2)) c(v1,v2)[order(c(ord1,ord2))] } x<-rbinom(100,1,0.5); plot(cumsum(interleave(x,1-x))/(1:200), type='l', ylim=c(0,1)) </code>

r-permuted-block-randomization.1336358117.txt.gz · Last modified: 2017/09/20 19:05 (external edit)