blockrand - Creating output with randomly inserted blocks

Hi all,

I'm using the blockrand package to create an allocation table for a randomized clinical trial and have been asked to set it up in a way I can't figure out. My code is below; it generates the 6:8 block sizes I need, and outputs without a problem. The challenge I have is that the Principal Investigator has now come back asking for "2 blocks to be randomly inserted", to have a pattern (for example) like 4/6/6/4/4/2/6/6/4/2/6. I don't know how to do this - I've spent a few hours playing around and reading various blogs etc. without luck.

Any help would be greatly appreciated. Thanks for your time,
Chris

mdd_int <- blockrand(n=20, block.sizes = 3:4, id.prefix = "MI", block.prefix = "MI", stratum = "MDD" )
mdd_con <- blockrand(n=20, block.sizes = 3:4, id.prefix = "MC", block.prefix = "MC", stratum = "MDD" )
gad_int <- blockrand(n=20, block.sizes = 3:4, id.prefix = "GI", block.prefix = "GI", stratum = "GAD" )
gad_con <- blockrand(n=20, block.sizes = 3:4, id.prefix = "GC", block.prefix = "GC", stratum = "GAD" )
my.study <- rbind(mdd_int, mdd_con, gad_int, gad_con)
write.csv(my.study, file="embc_random.csv")

Hi all -

I hope you had a good weekend - apologies for bumping this but I need to present my allocation table to the study team tomorrow and still don't know what I need to do to randomly insert 2-sized blocks into my table (4:6 blocks) using blockrand. If anyone has ideas I'd appreciate it.
Thanks
Chris

Hi Chris,
While I, unfortunately, don't have an answer for you I thought it might be helpful to share the R in Healthcare Slack community link in case someone may be able to help in the future there as well: Join rinhealthcare on Slack | Slack

1 Like

Hi Rachael!

Thank you!! I actually reached out to the author of blockrand and he confirmed that there's no way to do this in his package. I can either use the uneq.mid=TRUE parameter, which will insert randomly sized blocks randomly into the table, or I can create the base table and then insert the 2 blocks myself.
I'll be joining the Slack channel as well, thanks again for sharing and I hope you have a good day :slight_smile: Chris

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.