From Allocation Probabilities to a Random Assignment
In a multi-arm doubly adaptive biased coin design (DBCD), the current allocation calculation produces a probability for assigning the next participant to each treatment arm. Those probabilities specify the randomization rule; they do not, by themselves, say which arm the participant receives. A random draw is needed to make that assignment. The implementation must preserve the specified probabilities, including when they are unequal or change as the trial progresses.
This tutorial takes the normalized probabilities as given and focuses on the sampling step. The notation \(p_{n+1,k}\) denotes the probability of assigning participant \(n+1\) to arm \(k\), given the trial history through participant \(n\). Write that history as \(\mathcal{H}_n\). The probability vector can depend on that history, but it must be calculated before the random draw for the next assignment.
If the probabilities are obtained by normalizing nonnegative weights \(w_{n+1,k}\), the calculation is \(p_{n+1,k}=w_{n+1,k}/\sum_{j=1}^{K}w_{n+1,j}\), provided the weight sum is positive. The sampler begins only after this vector has been computed and checked. In particular, the target shares used within a DBCD calculation are not automatically the probabilities used for the next assignment: the sampler uses the current, normalized assignment probabilities.
The Cumulative-Interval Rule
Let \(U_{n+1}\) be a random variable uniformly distributed on \([0,1)\), generated for the next assignment after the probabilities are determined. Define cumulative probabilities \(C_0=0\) and \(C_k=\sum_{j=1}^{k}p_{n+1,j}\) for \(k=1,\ldots,K\). Assign participant \(n+1\) to arm \(k\) when \(C_{k-1}\leq U_{n+1}<C_k\). The final cumulative value is \(C_K=1\).
This convention assigns a draw exactly on an interior boundary to the interval on its right. Under a continuous uniform distribution, the probability of landing exactly on any specified boundary is zero, so another consistent endpoint convention gives the same probabilities. Nevertheless, an implementation needs a definite convention so that every possible computer-generated draw is handled unambiguously. A draw from \([0,1)\) is always covered, including \(U_{n+1}=0\).
Worked Example: Three Arms and One Draw
Suppose a hypothetical DBCD calculation gives weights 4, 5, and 3 for arms 1, 2, and 3. Their sum is 12, so the normalized probabilities are
The cumulative boundaries are \(C_0=0\), \(C_1=1/3\), \(C_2=1/3+5/12=3/4\), and \(C_3=1\). Thus the three intervals are \([0,1/3)\), \([1/3,3/4)\), and \([3/4,1)\). If the hypothetical uniform draw is \(U_{n+1}=0.70\), then \(1/3\leq 0.70<3/4\), so the participant is assigned to arm 2. The interval containing the draw determines the assignment; selecting the arm with the largest probability would not implement this randomization rule.
Why the Interval Lengths Give the Right Probabilities
The justification follows directly from the uniform distribution. Conditional on the history and the calculated probability vector, \(U_{n+1}\) is uniform on an interval of length 1. The probability that it falls in an interval is that interval’s length. The interval for arm \(k\) has length \(C_k-C_{k-1}=p_{n+1,k}\), which gives the required conditional probability.
The intervals also form a partition of \([0,1)\): the first begins at 0, adjacent intervals share a boundary without overlapping under the stated convention, and the last ends at 1. A zero probability creates an interval of length zero, so that arm cannot be selected by this draw. A positive probability creates an interval of exactly that length. These facts establish both coverage and the intended assignment probabilities.
Worked Example: Four Arms From Normalized Weights
In a hypothetical four-arm allocation, suppose the current nonnegative weights are 2, 5, 6, and 7. Their sum is 20, which is positive, so normalization gives
The probabilities are nonnegative and sum to \(0.10+0.25+0.30+0.35=1.00\). The cumulative boundaries are \(0\), \(0.10\), \(0.35\), \(0.65\), and \(1.00\). The intervals are therefore \([0,0.10)\), \([0.10,0.35)\), \([0.35,0.65)\), and \([0.65,1)\). For the hypothetical draw \(U_{n+1}=0.62\), the inequalities \(0.35\leq 0.62<0.65\) hold, so arm 3 is selected. Its interval length is \(0.65-0.35=0.30\), exactly its normalized probability.
Worked Example: Checking Several Assignments
Suppose, for illustration, that the probability vector remains \((0.20,0.50,0.30)\) for five hypothetical assignments. Its intervals are \([0,0.20)\) for arm 1, \([0.20,0.70)\) for arm 2, and \([0.70,1)\) for arm 3. Consider the draws \(0.14, 0.63, 0.91, 0.42,\) and \(0.77\).
The draw \(0.14\) falls in arm 1’s interval. The draws \(0.63\) and \(0.42\) fall in arm 2’s interval. The draws \(0.91\) and \(0.77\) fall in arm 3’s interval. The resulting assignment sequence is arm 1, arm 2, arm 3, arm 2, arm 3, giving counts 1, 2, and 2. Those observed counts are not required to equal the probabilities multiplied by five: randomization produces variable counts. The check here is that each individual draw was mapped using its correct interval.
Implementation Checks and Common Failure Modes
A reliable implementation can be audited in a few steps before and after each draw. First, confirm that the probability vector corresponds to the current history and that each entry is nonnegative. Next, check the total using full-precision values. Then construct cumulative boundaries in arm order and verify that they are nondecreasing, begin at zero, and end at one. Finally, confirm that the assigned arm is the one whose interval contains the generated draw.
Check \(p_{n+1,k}\geq 0\) for every arm and \(\sum_{k=1}^{K}p_{n+1,k}=1\), allowing only a stated numerical tolerance for floating-point arithmetic.
Set \(C_0=0\) and add the probabilities in the specified arm order. Check that \(C_K\) is represented as 1 for interval coverage, without changing the underlying probabilities to hide a substantive normalization error.
Generate one uniform draw for this assignment and find the unique interval containing it. Record the draw, the probability vector, and the resulting arm when an audit trail is required.
A common mistake is to round each probability for display and then use those rounded values to construct the intervals. Rounding can make the probabilities sum to something other than 1, or slightly change the intended assignment chances. The correction is to retain full precision for normalization and cumulative sums, and round only the values shown in reports. Another error is to assign each participant to the currently largest-probability arm. That is deterministic selection, not categorical sampling, and does not give arm \(k\) its specified probability \(p_{n+1,k}\).
Other useful diagnostics include checking for a decreasing cumulative boundary, a gap or overlap between intervals, and code that can return no arm or more than one arm for a draw in \([0,1)\). If an arm has probability zero, its interval is empty; if a boundary is repeated, the interval at that position has zero length. Such cases are valid when they arise from the stated probabilities, but they should be distinguished from coding errors. A computer’s finite-precision random-number generator is not literally continuous; standard categorical-sampling routines account for the generator’s representation. For an implementation written by hand, boundary handling and the final endpoint deserve explicit tests.
Alternative Samplers and Scope
A standard categorical-sampling routine is usually the simplest software alternative to hand-coded cumulative intervals. Given a valid probability vector, it returns one category according to those probabilities. It can reduce boundary-handling mistakes, but the vector passed to it still needs to be the correct current DBCD assignment vector. Software cannot repair an incorrectly normalized input or a mismatch between the recorded probabilities and the trial’s allocation calculation.
A second equivalent approach uses sequential binary draws. First select arm 1 with probability \(p_{n+1,1}\); if it is not selected, select arm 2 with conditional probability \(p_{n+1,2}/(1-p_{n+1,1})\), then continue with the remaining probability mass. When the denominators are positive and each conditional probability is computed correctly, this construction gives arm \(k\) unconditional probability \(p_{n+1,k}\). It requires more conditional calculations and careful handling when no probability mass remains. The cumulative-interval method makes the partition visible and is especially convenient for hand verification.
Both methods implement the same categorical distribution when correctly specified. In a response-adaptive design, the probabilities can differ from one participant to the next because the observed history changes; that does not make a single assignment draw less random. The sampler assumes that all listed arms are available for this assignment and that the calculated probabilities already account for the design being implemented. It does not impose additional enrollment rules or constraints. Nor does a correct sampler guarantee that the probability calculation itself is correct: it verifies the draw step, not every preceding part of a DBCD.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- For probabilities \((0.15,0.35,0.50)\), write the cumulative intervals and identify the arm selected by \(U=0.50\).
- For probabilities \((0.40,0.35,0.30)\), identify the problem and explain whether cumulative-interval sampling should proceed as written.
- For probabilities \((0.25,0.25,0.50)\), what is the assignment when \(U=0.25\) under the endpoint convention in this tutorial?
- Explain why observed allocations over a small number of assignments need not match the probability vector exactly.
Solutions. (1) The cumulative boundaries are \(0,0.15,0.50,1\), giving intervals \([0,0.15)\), \([0.15,0.50)\), and \([0.50,1)\). Since the lower endpoint is included, \(U=0.50\) selects arm 3. (2) The entries sum to \(0.40+0.35+0.30=1.05\), not 1. The vector must be checked and correctly normalized before sampling; proceeding as written would not partition \([0,1)\) with the intended probabilities. (3) The intervals are \([0,0.25)\), \([0.25,0.50)\), and \([0.50,1)\). The boundary belongs to the interval on its right, so the assignment is arm 2. (4) The probabilities describe the chance of each arm on an assignment, not fixed proportions of a short realized sequence. Random variation can produce counts above or below their probability-weighted averages.