Tutorials › Response-Adaptive Randomization › Monte Carlo Randomization Tests For Adaptive Trials

Randomization-Based Inference · Tutorial 458 of 501

Monte Carlo Randomization Tests For Adaptive Trials

You will learn to reproduce an adaptive trial’s sequential randomization mechanism in simulation and use the resulting paths to obtain a calibrated Monte Carlo test.

Advanced 10 min read

What You'll Learn

  • Specify the sharp-null and design assumptions needed for an adaptive randomization test.
  • Simulate complete assignment paths using the probability prescribed by each simulated history.
  • Calculate a Monte Carlo p-value using the finite-simulation correction.
  • Explain why the correction prevents a zero p-value and controls Monte Carlo testing error.
  • Diagnose implementation errors, inadequate simulation counts, and misuse of fixed-allocation permutations.

Why Use Monte Carlo Randomization Tests?

An adaptive trial may have many possible assignment paths. Exact enumeration evaluates the test statistic on every path allowed by the design, but the number of paths can become too large for that calculation to be practical. Monte Carlo randomization tests approximate the randomization distribution by generating a manageable number of complete paths from the trial’s actual sequential assignment mechanism.

The key is to simulate the mechanism, not merely to reshuffle the final treatment labels. At each enrollment step, the next assignment probability may depend on assignments and outcomes observed so far. Thus a simulated path must update the history and use the probability specified for that history. The resulting test is meaningful only if the null hypothesis and the simulation correctly represent how outcomes and assignments would behave under the design.

Assumptions and Setup

Consider \(n\) participants enrolled in a specified order. Let \(A_t\) denote the assignment of participant \(t\), and let \(H_{t-1}\) denote the history available immediately before that assignment. The design specifies the conditional probability \(q_t(H_{t-1})=P(A_t=1\mid H_{t-1})\), with the probability of the other arm equal to \(1-q_t(H_{t-1})\). The history may include earlier assignments, observed responses, and recorded covariates. The function \(q_t\) must describe the rule actually used, including any caps, burn-in period, or other design restrictions.

For a Fisher randomization test, take the null hypothesis to be a sharp null: every participant’s outcome would be the same under every possible treatment assignment. Under this null, the observed outcome for each participant can be treated as fixed when assignments are regenerated. The test also requires the enrollment order and relevant covariates to be treated as fixed, and the assignment algorithm to be known and correctly reconstructed. If the adaptive rule uses outcomes, each simulated path must use the fixed outcomes in the simulated treatment groups to update that rule’s history.

Definition: A Monte Carlo randomization test generates \(M\) independent complete assignment paths from the specified randomization mechanism under the null, calculates the test statistic for each path using the null-imputed outcomes, and compares those statistics with the statistic from the observed path.

Choose a statistic \(T\) before examining the simulation results. For a two-sided test, one common choice is to compare \(|T|\); for a one-sided test, the direction must be specified in advance. The observed statistic is \(T_{\mathrm{obs}}\), and the simulated statistics are \(T_1,\ldots,T_M\). The statistic may be a difference in means or another pre-specified measure of departure from the null; the same definition must be applied to the observed and simulated assignments.

Simulating Complete Adaptive Paths

For each replicate, begin with the initial history, draw the first assignment according to the design, and then update the history with that assignment and the corresponding fixed outcome under the sharp null. Continue participant by participant. Do not calculate all assignment probabilities from the observed trial’s final history: each replicate generally has its own evolving history and therefore its own later probabilities.

1
Initialize the history.
Use the fixed enrollment order, covariates, and any initial design state required by the trial algorithm.
2
Draw the next assignment.
At step \(t\), calculate \(q_t(H_{t-1})\) from the current simulated history and draw \(A_t\) with that conditional probability.
3
Update the history.
Under the sharp null, attach the fixed outcome for participant \(t\) to the simulated assignment and update every summary used by the rule.
4
Calculate the statistic.
After all \(n\) assignments, calculate \(T\) using the same formula used for the observed path.
5
Repeat and count extremes.
Repeat independently \(M\) times and count simulated statistics at least as extreme as the observed statistic.

Worked Example: Reproducing a Toy Adaptive Path

Consider a hypothetical three-person trial with two arms, labelled A and B. Write \(A_t=1\) for arm A. The first assignment has probability \(0.5\) of being A. For the second participant, the probability of A is \(0.7\) if the first participant’s fixed binary outcome is 1, and \(0.3\) otherwise. For the third participant, the probability of A is \(0.8\) if the first participant was assigned A and had outcome 1, and \(0.4\) otherwise. Suppose the fixed outcomes under the sharp null are \(1,0,1\).

For the path A, B, A, the first assignment probability is \(0.5\). Because the first outcome is 1, the probability of assigning participant 2 to B is \(1-0.7=0.3\). The first participant was assigned A and had outcome 1, so the probability of assigning participant 3 to A is \(0.8\). Thus the path probability is

$$ P(\mathrm{A,B,A})=0.5(0.3)(0.8)=0.12. $$

The calculation uses the conditional probabilities along this particular path. A different first assignment or first outcome would change the later probabilities according to the rule. In the Monte Carlo procedure, the same rule is applied afresh to every simulated history; the observed path’s later probabilities are not copied into every replicate.

The Finite-Simulation p-Value

For a two-sided test based on absolute values, let \(b\) be the number of simulated statistics satisfying \(|T_m|\geq |T_{\mathrm{obs}}|\). The finite-simulation p-value is

$$ \hat{p}_{\mathrm{MC}}=\frac{b+1}{M+1}. $$

For a pre-specified upper-tailed test, count \(T_m\geq T_{\mathrm{obs}}\); for a lower-tailed test, count \(T_m\leq T_{\mathrm{obs}}\). In each case use the same \((b+1)/(M+1)\) correction. Comparisons include ties, making the test conservative when the statistic’s randomization distribution has ties. The correction also ensures that the p-value is never zero: its smallest possible value is \(1/(M+1)\).

Justification: Under the sharp null, the observed assignment path and \(M\) independently generated paths have the same randomization distribution, conditional on the fixed outcomes and design inputs. Their statistics are therefore exchangeable. The rank of the observed statistic among the \(M+1\) statistics is uniform when there are no ties; counting ties as extreme gives a conservative tail comparison. Including the observed statistic in the count and denominator yields \((b+1)/(M+1)\), rather than the potentially zero estimate \(b/M\).

This justification depends on generating paths from the correct mechanism. It does not say that Monte Carlo error disappears, nor that the p-value is the probability the null is true. Rather, it gives a valid randomization test under the stated sharp null, with additional discreteness and simulation variability determined by \(M\).

Worked Example: Calculating a Corrected Monte Carlo p-Value

Suppose a hypothetical adaptive trial has observed absolute test statistic \(|T_{\mathrm{obs}}|=2.4\) response points. Investigators generate \(M=999\) independent paths and find that 37 simulated statistics satisfy \(|T_m|\geq 2.4\).

Here \(b=37\), so the corrected two-sided Monte Carlo p-value is

$$ \hat{p}_{\mathrm{MC}}=\frac{37+1}{999+1}=\frac{38}{1000}=0.038. $$

The estimated randomization tail probability is about 0.038. If the pre-specified significance level were \(\alpha=0.05\), this result would be below that threshold. It is not a 3.8% probability that the null hypothesis is true. The uncorrected fraction \(37/999\) is close, but the correction is important for calibration and prevents reporting a p-value of zero when no simulated statistic is as extreme as the observed one.

Simulation Accuracy and Diagnostics

A Monte Carlo p-value is discrete and has simulation error because it is based on a finite number of generated paths. If the true randomization tail probability is approximately \(r\), the standard deviation of the simulated tail fraction is approximately \(\sqrt{r(1-r)/M}\). This is a measure of numerical simulation variability, not the sampling uncertainty in a treatment-effect estimate. Increasing \(M\) improves resolution and reduces this variability, but cannot fix a misspecified assignment algorithm.

Worked Example: Choosing the Number of Simulations

Suppose a hypothetical analysis expects a tail probability near \(0.05\) and wants the Monte Carlo standard deviation to be about \(0.002\) or less. Using the approximation above, require

$$ \sqrt{\frac{0.05(1-0.05)}{M}}\leq 0.002. $$

Squaring both sides gives \(0.0475/M\leq 0.000004\), so \(M\geq 0.0475/0.000004=11{,}875\). This calculation is a planning approximation: the actual tail probability is unknown, and the corrected p-value remains discrete. It does show why a few hundred replicates may be inadequate when a precise p-value near 0.05 is needed.

Before trusting the result, check that the observed assignment path can be replayed under the reconstructed algorithm and that the recorded conditional probabilities agree with the trial history. In code, verify that the two arm probabilities sum to one at each step, that deterministic design decisions are implemented as deterministic, and that all adaptive summaries are updated at the correct time. Independent complete paths are the standard simple Monte Carlo approach; repeatedly modifying one path or using a fixed final allocation count does not produce the same reference distribution.

A useful computational diagnostic is to examine simulated allocation totals and histories. They should be plausible under the design, although they need not match the observed totals. A mismatch can reveal a coding error, but a match is not proof of correctness. Also report \(M\), \(b\), the tail rule, and the corrected p-value so that the simulation resolution is transparent.

How This Differs From Common Alternatives

ApproachWhat it doesMain consideration
Exact path enumerationEvaluates every assignment path allowed by the design.Provides the exact randomization distribution but can be computationally infeasible when the path space is large.
Monte Carlo randomizationSamples complete paths from the sequential design mechanism.Scales to large path spaces but has finite simulation error and requires a faithful implementation.
Fixed-allocation permutationPermutes labels while holding final arm counts fixed.Generally does not reproduce an adaptive design’s path probabilities or histories.

Monte Carlo simulation approximates the same design-based reference distribution that exact enumeration would calculate, subject to simulation error. It is not a license to replace the adaptive rule with a simpler randomization scheme. In particular, holding final allocation counts fixed can exclude paths that the adaptive design could generate and assign the remaining paths the wrong probabilities.

Common Mistakes and Limitations

  • Using the observed probability sequence for every replicate. Later assignment probabilities depend on each replicate’s own history; recompute them as the path evolves.
  • Reassigning outcomes when the sharp null says they are fixed. Under the sharp null, attach each participant’s observed outcome to that participant in every simulated assignment path.
  • Reporting \(b/M\) as though it could never be zero. Use \((b+1)/(M+1)\) for the finite-simulation test, and report \(M\) because it determines the minimum attainable value.
  • Interpreting simulation error as treatment-effect uncertainty. The Monte Carlo standard error describes numerical variability from drawing paths, not uncertainty in an estimated clinical effect.
  • Assuming a correct simulation validates any null hypothesis. This procedure’s sharp-null justification relies on outcomes being imputable under that null. It does not by itself establish validity for every weaker null or every alternative inferential target.

The method’s practical limitations are therefore both computational and scientific. A very large \(M\) costs time, and even unlimited simulation cannot repair an incorrect reconstruction, an outcome-dependent enrollment process omitted from the model, or a null hypothesis that does not justify the outcome imputation. State the null, the fixed inputs, the assignment rule, the statistic, and the simulation count as part of the analysis.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. A design assigns the next participant with probability 0.6 to arm A based on the current simulated history. What probability should be used for arm B, and when should that probability be recalculated?
  2. In a two-sided test, \(M=499\) simulated paths produce \(b=9\) statistics at least as extreme as the observed statistic. Calculate the corrected Monte Carlo p-value.
  3. Why is a corrected Monte Carlo p-value not zero when no simulated statistic is as extreme as the observed statistic?
  4. A researcher simulates assignments while forcing every path to have the observed final arm counts. What is the main concern?

Solutions. (1) The probability of B is \(1-0.6=0.4\). Recalculate the probabilities at each step using that replicate’s updated history. (2) \((b+1)/(M+1)=(9+1)/(499+1)=10/500=0.020\). (3) If \(b=0\), the correction gives \(1/(M+1)\), reflecting the observed path’s inclusion in the rank comparison and the finite resolution of the simulation. (4) Forcing final counts generally changes the adaptive design’s path distribution; paths should instead be generated sequentially from the actual assignment rule.

Clinical Biostats