User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

r-permuted-block-randomization [2017/09/20 19:05] (current)
Line 1: Line 1:
 +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. 
 +interleave <- function(v1,​v2) { 
 +    ord1 <- 2*(1:​length(v1))-1 
 +    ord2 <- 2*(1:​length(v2)) 
 +    c(v1,​v2)[order(c(ord1,​ord2))] 
 +plot(cumsum(interleave(x,​1-x))/​(1:​200),​ type='​l',​ ylim=c(0,​1)) 
r-permuted-block-randomization.txt · Last modified: 2017/09/20 19:05 (external edit)