DeclareDesign / randomizr

randomizr: Easy-to-Use Tools for Common Forms of Random Assignment and Sampling
https://declaredesign.org/r/randomizr
Other
36 stars 9 forks source link

Changes in treatment assignment from 0.12 to 0.16 #73

Closed lukesonnet closed 6 years ago

lukesonnet commented 6 years ago

See the following MWE:

install.packages("randomizr") # currently on version 0.16

library(randomizr)
prs <- rep(1/7, times = 7)
bls <- paste0(rep(letters[1:6], each = 100), rep(1:3, times = c(40, 10, 50)))
set.seed(42)
t1 <- block_ra(blocks = bls, prob_each = prs)

devtools::install_version("randomizr", "0.12.0")

library(randomizr)
set.seed(42)
t2 <- block_ra(blocks = bls, prob_each = prs)
table(t1==t2)

The result is that there are a few cases where the randomization is not equivalent. Indeed I believe this is due to a change in load balancing (Issue #35). This isn't ideal for those of us who use randomizr in old randomizations and rely on rerunning those scripts to ensure the randomization protocol doesn't change as data upstream from the randomization changes. Also, would like to know (for a friend) if the old version was "wrong" because then I've got a bigger problem.

acoppock commented 6 years ago

I believe that the new version is "better" but that the old version was not "wrong". I think you're seeing differences because of https://github.com/DeclareDesign/randomizr/issues/50.

So yes, the randomization distribution under 12 admits slightly more possibilities than under 16.