Tutorials › Response-Adaptive Randomization › Replacement Matrices for Urn Designs

Urn Models · Tutorial 48 of 501

Replacement Matrices for Urn Designs

Represent a fixed urn update rule with a matrix, select the column for the drawn treatment, and calculate and verify the resulting composition.

Intermediate 9 min read

What You'll Learn

  • Define the dimensions and entries of a replacement matrix for multiple treatments.
  • Use a treatment indicator vector to select the column corresponding to a draw.
  • Calculate updated ball counts and total urn size from a replacement matrix.
  • Distinguish added balls from the drawn ball returned to the urn.
  • Diagnose column-orientation, bookkeeping, and zero-column errors.

Why Represent Urn Updates With a Matrix?

An urn design can be described not only by the current numbers of balls for each treatment, but also by a rule for updating those numbers after a treatment is drawn. When the rule is fixed, a matrix records all the possible updates at once: each column corresponds to a treatment draw, and the entries in that column say how many balls of each treatment type are added. This representation is useful for keeping multi-treatment updates organized and for checking the resulting composition systematically.

The convention here is that the ball drawn is returned to the urn, as in the earlier material on returning the drawn ball. The replacement matrix records additional balls added after that return; it does not count the drawn ball itself. The updates considered here add balls only, with a fixed rule that does not depend on a participant's response.

Definition and Assumptions

Definition: For \(K\) treatments, let \(x=(x_1,\ldots,x_K)^T\) be the urn composition, where \(x_i\) is the number of balls labelled for treatment \(i\). A replacement matrix \(R=(r_{ij})\) is a \(K\)-by-\(K\) matrix in which column \(j\) specifies the additional balls added after a ball for treatment \(j\) is drawn. Entry \(r_{ij}\) is the number of treatment-\(i\) balls added after a treatment-\(j\) draw.

For this add-only rule, each \(r_{ij}\) is a nonnegative integer. The urn must have a positive total number of balls before a draw, so \(\sum_{i=1}^{K}x_i>0\), and each \(x_i\) is a nonnegative integer. At a draw, exactly one treatment label is selected. The selected ball is returned, and the additions specified by the corresponding matrix column are made. The same matrix applies after every draw.

Thus a replacement matrix has one row for each ball type that may be added and one column for each treatment that may be drawn. Its entries are counts, not probabilities. A column may consist entirely of zeros: drawing that treatment then returns the drawn ball but adds no extra balls.

Selecting the Column for a Draw

Let \(e_j\) be a \(K\)-dimensional vector with a 1 in position \(j\) and 0 in every other position. Multiplying \(R\) by \(e_j\) selects column \(j\) of \(R\). Since the drawn ball is returned, the updated composition is the old composition plus that column.

$$ x'=x+Re_j $$

In component form, if treatment \(j\) is drawn, then \(x_i'=x_i+r_{ij}\) for every treatment \(i\). This component equation is often the simplest way to check an update: the new count for treatment \(i\) is its old count plus the entry in row \(i\) of the selected column. The total number of balls after the draw is

$$ \sum_{i=1}^{K}x_i'=\sum_{i=1}^{K}x_i+\sum_{i=1}^{K}r_{ij}. $$

The increase in total size is the sum of the entries in the selected column. If that column is all zeros, the composition and total size remain unchanged. If every column has the same sum, every draw adds the same total number of balls, although the types of balls added can still depend on the drawn treatment.

Worked Example: A Two-Treatment Update

Suppose an urn has 4 treatment-1 balls and 2 treatment-2 balls. Its composition is \(x=(4,2)^T\). After a treatment-1 draw, the rule adds 1 treatment-1 ball and 2 treatment-2 balls. After a treatment-2 draw, it adds 0 treatment-1 balls and 1 treatment-2 ball. Write the replacement matrix and update the composition after a treatment-1 draw.

The columns follow the order of the possible draws, and the rows follow the order of the ball types being added. Therefore,

$$ R= \begin{pmatrix} 1&0\\ 2&1 \end{pmatrix}, \qquad e_1= \begin{pmatrix} 1\\ 0 \end{pmatrix}. $$

The first column is selected. The drawn treatment-1 ball is returned, and the additional balls are represented by \(Re_1=(1,2)^T\). Hence

$$ x'=x+Re_1 = \begin{pmatrix}4\\2\end{pmatrix} + \begin{pmatrix}1\\2\end{pmatrix} = \begin{pmatrix}5\\4\end{pmatrix}. $$

The urn now contains 5 treatment-1 balls and 4 treatment-2 balls, 9 balls in total. The selected column sums to \(1+2=3\), and the total has increased from \(4+2=6\) to 9, which checks the calculation. If the urn is drawn from again without another change to the rule, the treatment-1 draw probability is \(5/9\) and the treatment-2 draw probability is \(4/9\).

Reading a Multi-Treatment Matrix

For more than two treatments, the same row-and-column convention applies. It is helpful to label both dimensions explicitly before doing arithmetic. In the next example, the first row counts treatment-1 balls added, the second row counts treatment-2 balls added, and the third row counts treatment-3 balls added. The columns specify which treatment was drawn.

Worked Example: Updating a Three-Treatment Composition

Suppose the urn composition is \(x=(3,1,2)^T\), and the replacement matrix is

$$ R= \begin{pmatrix} 0&1&0\\ 1&0&2\\ 2&1&0 \end{pmatrix}. $$

Find the updated composition after a treatment-2 draw. The treatment-2 draw selects column 2, which is \((1,0,1)^T\). The update is

$$ x'=x+Re_2 = \begin{pmatrix}3\\1\\2\end{pmatrix} + \begin{pmatrix}1\\0\\1\end{pmatrix} = \begin{pmatrix}4\\1\\3\end{pmatrix}. $$

Thus the new counts are 4, 1, and 3 balls for treatments 1, 2, and 3, respectively. The original total is \(3+1+2=6\); the selected column adds \(1+0+1=2\) balls; and the updated total is \(4+1+3=8\). The treatment-2 count does not increase in this update, because the selected column has a zero in row 2.

The matrix is a compact way to store the rule, but its meaning remains concrete: after treatment \(j\) is drawn, the entries in column \(j\) are added to the corresponding treatment counts. It is not necessary for an entry on the diagonal to be positive. Nor does a nonzero entry in the selected column mean the drawn ball was not returned; return of the drawn ball is already part of the stated convention.

Worked Example: A Zero Column Leaves the Composition Unchanged

Let \(x=(2,3)^T\), and suppose

$$ R= \begin{pmatrix} 0&1\\ 0&2 \end{pmatrix}. $$

If treatment 1 is drawn, the selected column is \((0,0)^T\). Therefore,

$$ x'=x+Re_1 = \begin{pmatrix}2\\3\end{pmatrix} + \begin{pmatrix}0\\0\end{pmatrix} = \begin{pmatrix}2\\3\end{pmatrix}. $$

The drawn ball is returned, but no additional balls are added, so the composition and total of 5 are unchanged. In contrast, a treatment-2 draw selects column \((1,2)^T\), giving \(x'=(2,3)^T+(1,2)^T=(3,5)^T\), with total \(3+5=8\). This illustrates why it is more accurate to say that the composition may change after an update: the selected column determines whether any additions occur.

A Short Justification and Practical Checks

The matrix formula follows directly from how its columns are defined. For a draw of treatment \(j\), the vector \(e_j\) has a 1 only at position \(j\). The \(i\)th component of \(Re_j\) is therefore

$$ (Re_j)_i=\sum_{\ell=1}^{K}r_{i\ell}(e_j)_\ell=r_{ij}, $$

because every term is zero except the term with \(\ell=j\). Thus \(Re_j\) contains exactly the additions specified for a treatment-\(j\) draw. Adding it to \(x\) gives \(x_i'=x_i+r_{ij}\) in every row, as required. This also shows why choosing a column, rather than a row, is essential under this convention.

After calculating an update, check three things. First, confirm that the selected column matches the treatment drawn. Second, check each new component against \(x_i'=x_i+r_{ij}\). Third, compare the new total with the old total plus the selected column sum. These checks can reveal a transposed matrix, an omitted addition, or an accidental count of the returned ball as an extra matrix addition.

Common Mistakes, Alternatives, and Limitations

  • Using a row instead of a column. The draw selects a column because columns encode the treatment drawn. Rows identify the type of ball added.
  • Counting the returned ball twice. Under the convention here, the drawn ball is returned independently of \(R\); the matrix records only additional balls.
  • Assuming every update changes the composition. A zero selected column adds nothing, so the composition stays the same.
  • Confusing entries with probabilities. Entries are numbers of balls added. The matrix itself is not an allocation-probability matrix.

For a small number of treatments, one can state an update rule in words or list each possible update separately. Those approaches can be easy to read, but a replacement matrix keeps all treatment-specific additions in one object and makes the chosen update a consistent column operation. The matrix is especially useful when several ball types can be added after a draw.

A fixed, add-only replacement matrix has limits. It describes a rule whose additions do not vary with the participant's response or the previous history, and its nonnegative entries cannot represent removal of balls. It also does not, by itself, describe every feature of a trial or determine how outcomes are generated. Here it is a precise bookkeeping device for a specified urn update rule.

Key takeaway: Label rows by the ball types added and columns by the treatment drawn. After a treatment-\(j\) draw, return the drawn ball and add column \(j\): \(x'=x+Re_j\). Check the component counts and the total against that column.

Check Your Understanding

Work each problem using the stated row-and-column convention. Solutions follow the questions.

  1. An urn has composition \(x=(5,2,1)^T\), and \(R=\begin{pmatrix}0&2&1\\1&0&0\\0&1&3\end{pmatrix}\). Find the updated composition and total after a treatment-3 draw.
  2. After a treatment-1 draw, a rule adds 0 treatment-1 balls and 2 treatment-2 balls. After a treatment-2 draw, it adds 3 treatment-1 balls and 0 treatment-2 balls. Write \(R\).
  3. A selected replacement column is \((2,0,1)^T\). By how much does the total urn size increase? Explain.
  4. What happens to the composition after a draw whose selected column is all zeros?

Solutions. (1) The treatment-3 draw selects column 3, \((1,0,3)^T\). Thus \(x'=(5,2,1)^T+(1,0,3)^T=(6,2,4)^T\), with total \(6+2+4=12\). (2) Columns correspond to the draw, so \(R=\begin{pmatrix}0&3\\2&0\end{pmatrix}\). (3) The total increases by the column sum, \(2+0+1=3\) balls. (4) No additional balls are added; the drawn ball is returned, so the composition is unchanged.

Clinical Biostats