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

Suggested feature: nearest-neighbor matching for continuous variables #82

Closed daaronr closed 5 years ago

daaronr commented 5 years ago

(Apologies if there's a way to do this that I missed; maybe this is something for the blockTools package, but I cannot understand how to 'exact' block on some variables and nearest-match on others in that package).

Suppose I want to block-randomize on Gender and Race, and then within these categories 'alternate' assignment by Age, so that within any small window of Age we will have an even balance of Control and Treatment(s). Is this do-able through your (great!) package? I could not find it in the docs.

acoppock commented 5 years ago

Thanks @daaronr -- no you're right that this is something for the blockTools package. Randomizr won't make blocks for you... but it'll randomize if you've already got a variable for blocking. Blocktools has a good way to do it https://gist.github.com/acoppock/89483cdce68867f8ee88e1f5cd2f318b

I'd also suggest checking out quickblock: https://github.com/fsavje/quickblock.