The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

sandwichrand

Allocation sequences by Sandwich Mixed Randomization (SMR) for randomized controlled trials.

sandwichrand generates treatment allocation sequences (randomization lists) with the Sandwich Mixed Randomization scheme described in Wang et al. (2026), BMC Medical Research Methodology 26(1), 152, doi:10.1186/s12874-026-02877-2.

The sandwich

An SMR sequence is a sandwich:

|<--- n1 --->|<-------- N - 2*n1 -------->|<--- n1 --->|
+------------+----------------------------+------------+
| block 1    | blocks 2 .. K              | block K+1  |
| imbalanced | permuted blocks of         | complement |
|            | varying sizes              | of block 1 |
+------------+----------------------------+------------+

Installation

# from the source tarball
install.packages("sandwichrand_1.0.0.tar.gz", repos = NULL, type = "source")

Quick start

library(sandwichrand)

## Two-arm 1:1 trial, N = 48 -- the illustration of the SMR paper
x <- smr_alloc(N = 48, arms = c("TestTrt", "Placebo"), seed = 84529052)
x
head(x$alloc)
x$balance

## Three-arm 2:2:1 trial, N = 150, released without the block structure
y <- smr_alloc(N = 150, arms = c("A", "A", "B", "B", "C"), seed = 123456,
               keep.blocks = FALSE)
smr_balance(y)

## Independent streams for high-frequency calling (simulation loops)
ss <- smr_streams(seed = 42, n = 3)
a <- smr_alloc(N = 48, arms = c("A", "B"), stream = ss[[1]])
b <- smr_alloc(N = 48, arms = c("A", "B"), stream = ss[[2]])

## Verify, document and release
smr_verify(x)
smr_write_csv(x, file = "randomization.csv")
smr_rtf(x, file = "randomization.rtf")

Evaluating the design

A randomization procedure is assessed on two performance metrics (Wang et al. 2026):

Both are summarised across replications by smr_simulate():

smr_simulate(N = 48, arms = c("A", "B"), reps = 1000, seed = 11)
# final imbalance (balance) and correct-guess PCG (unpredictability)

Design highlights

Documentation

The package vignette (vignette("sandwichrand")) follows the structure recommended for a Journal of Statistical Software contribution: motivation → methods → implementation → usage → validation → reproducibility → computational details → summary.

Clinical use and validation disclaimer

sandwichrand is research software provided “AS IS”, without warranty of any kind, express or implied. It has not been validated as a computerised system under Good Clinical Practice (GCP), Good Clinical/Manufacturing Practice (GxP), 21 CFR Part 11, EU GMP Annex 11, or any other regulatory framework.

Before using sandwichrand to generate allocation sequences for a registration trial, or for any trial whose results may support a regulatory submission, the sponsor is solely responsible for:

The authors accept no liability for any consequences arising from the use of this software.

License

Apache License (>= 2.0). The SMR scheme was designed by Bingshun Wang.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.