Tutorials › Response-Adaptive Randomization › Distinguishing Temporal Drift From Random Imbalance

Time Trends and Drift · Tutorial 392 of 501

Distinguishing Temporal Drift From Random Imbalance

Use the assignment probabilities available before each allocation to diagnose temporal imbalance without mistaking a statistical signal for proof of bias.

Advanced 10 min read

What You'll Learn

  • Separate intended changes in allocation probability from departures in the assignments actually observed.
  • Define sequential assignment residuals and their predictable variance.
  • Assess bin-specific and persistent patterns while respecting adaptive dependence.
  • Recognize when a normal approximation is only a screening diagnostic.
  • Identify why raw arm-by-time comparisons can mislead.
  • Interpret a signal as a reason to investigate, not as proof of bias.

Why a Time Pattern Needs a Reference

An arm-by-time table can show that one treatment received a larger share of assignments early and a smaller share later. That pattern alone does not tell us whether allocation departed from the design. The intended probability of assigning a participant to that arm may have changed over time, for example because the response-adaptive algorithm updated its probabilities. Even if the intended probability stayed fixed, random assignments can produce uneven counts across periods.

The relevant comparison is therefore between observed assignments and the probabilities in force immediately before those assignments. The probabilities provide a reference for ordinary random variation under the implemented randomization mechanism. A persistent discrepancy may warrant investigation, but a diagnostic statistic is not proof that the allocation process was biased or improperly implemented.

Definition: Let \(A_i=1\) if participant \(i\) is assigned to the treatment arm of interest and \(A_i=0\) otherwise. Let \(\mathcal{F}_{i-1}\) denote all information available immediately before assignment \(i\), and let \(\pi_i=P(A_i=1\mid\mathcal{F}_{i-1})\) be the assignment probability specified by the design at that moment. The sequential assignment residual is \(D_i=A_i-\pi_i\). It is positive when that assignment is to the arm more often than its pre-assignment probability would suggest, and negative when it is less often.

This framework requires that the recorded \(\pi_i\) is the probability actually used for assignment, that it is based only on information available before assignment \(i\), and that assignments are generated according to the stated mechanism. Calendar-time bins should be defined independently of the observed assignment pattern. If the algorithm uses earlier outcomes or assignments, those inputs belong to \(\mathcal{F}_{i-1}\); adaptivity does not invalidate the definition, but it makes correct logging of the probabilities especially important.

A changing \(\pi_i\) is not itself a discrepancy. It describes a changing intended allocation. The diagnostic question is whether the realized \(A_i\)'s are unusually far from the sequential probabilities that governed them—not whether each time period has the same treatment proportion.

Residuals Across Time Bins

For a calendar-time bin \(b\), let \(I_{ib}=1\) if participant \(i\) belongs to that bin and \(0\) otherwise. Define the bin's assignment residual total \(S_b\) and its predictable variance \(V_b\) by

$$ S_b=\sum_i I_{ib}(A_i-\pi_i), \qquad V_b=\sum_i I_{ib}\pi_i(1-\pi_i). $$

The expected assignment count under the recorded probabilities is \(\sum_i I_{ib}\pi_i\), so \(S_b\) is the observed count minus that expected count. \(V_b\) is called the predictable variance because each contribution \(\pi_i(1-\pi_i)\) is determined from information available before assignment \(i\). It is the accumulated conditional variance used in martingale-based inference; it is not, in general, a variance conditional on the complete realized sequence of probabilities.

When \(V_b\) is adequate and no single assignment dominates the sum, a rough standardized diagnostic is \(Z_b=S_b/\sqrt{V_b}\). Under suitable martingale central limit conditions, this may be approximately standard normal. It is not an exact finite-sample test by definition. In particular, a probability sequence produced adaptively can reveal information about earlier assignments. Conditioning on that full realized sequence may therefore change the distribution of the residuals; treating it as fixed and independent of those assignments is generally unjustified.

Why the Sequential Variance Is Appropriate

The justification begins with the information available just before each allocation. Under the specified assignment mechanism,

$$ E(D_i\mid\mathcal{F}_{i-1})=0, \qquad E(D_i^2\mid\mathcal{F}_{i-1})=\pi_i(1-\pi_i). $$

The first equality follows because \(E(A_i\mid\mathcal{F}_{i-1})=\pi_i\). For the second, \(A_i\) is conditionally Bernoulli with probability \(\pi_i\), so its conditional variance—and thus the conditional second moment of \(A_i-\pi_i\)—is \(\pi_i(1-\pi_i)\).

For \(S=\sum_i D_i\), the residuals at different times have zero cross-products in expectation. If \(j<i\), then \(D_j\) is known by time \(i-1\), and

$$ E(D_jD_i)=E\{D_j E(D_i\mid\mathcal{F}_{i-1})\}=0. $$

Consequently, under these assumptions,

$$ \operatorname{Var}(S) =\sum_i E\{D_i^2\} =E\left\{\sum_i\pi_i(1-\pi_i)\right\} =E(V). $$

The realized \(V\) is the predictable variance accumulated along the trial, not generally the exact variance of \(S\) conditional on the full probability path. Standardizing by its realized value is useful in martingale asymptotics, with appropriate regularity conditions; it does not license conditioning on that path. When those conditions are doubtful or the sample is small, calibration should respect the actual adaptive mechanism rather than assume a fixed probability sequence.

Worked Example: A Fixed Allocation Probability

Suppose a hypothetical trial enrolls 20 participants in each of four prespecified time bins. The design assigns each participant to the treatment arm with probability \(\pi_i=0.5\). The observed treatment-arm counts are 12, 8, 13, and 7.

In each bin the expected treatment count is \(20(0.5)=10\), and the predictable variance is \(20(0.5)(0.5)=5\). The residual totals are \(12-10=2\), \(8-10=-2\), \(13-10=3\), and \(7-10=-3\). Their standardized diagnostics are, respectively, \(2/\sqrt{5}=0.894\), \(-2/\sqrt{5}=-0.894\), \(3/\sqrt{5}=1.342\), and \(-3/\sqrt{5}=-1.342\).

The signs alternate rather than persist in one direction. The overall residual is \(2-2+3-3=0\), with total predictable variance \(4(5)=20\). These numbers do not suggest a sustained excess of treatment assignments relative to the 0.5 probabilities. They do not establish that every aspect of the randomization operated correctly; they only summarize this particular discrepancy.

Distinguishing a Probability Trend From a Residual Trend

The assignment-probability timeline and the residual timeline answer different questions. The first describes what the design intended; the second describes departures from that intention. A rising treatment proportion in the table may simply follow a rising \(\pi_i\). Conversely, a roughly stable overall treatment proportion can conceal a sequence of residuals that are mostly positive early and mostly negative later.

Worked Example: A Planned Change Explains the Observed Counts

In a hypothetical trial, there are 20 assignments in each of three prespecified periods. The treatment probabilities are 0.40, 0.50, and 0.60, respectively, and the observed treatment counts are 8, 10, and 12.

The expected counts are \(20(0.40)=8\), \(20(0.50)=10\), and \(20(0.60)=12\). Thus the residuals are \(8-8=0\), \(10-10=0\), and \(12-12=0\): the table's increasing treatment share exactly follows the planned probabilities.

The predictable variances are \(20(0.40)(0.60)=4.8\), \(20(0.50)(0.50)=5\), and \(20(0.60)(0.40)=4.8\). The total residual is zero and the total predictable variance is \(14.6\). The rise from 40% to 60% is an intended allocation trend in this example, not evidence of an unexplained allocation shift.

Worked Example: A Persistent Positive Departure

Consider another hypothetical trial with three prespecified periods of 20 assignments each. For illustration, the probabilities used within the periods are 0.50, 0.60, and 0.70; the corresponding observed treatment counts are 13, 15, and 17. Assume the logged probabilities are the probabilities applied before the assignments, even if the adaptive rule that generated them used earlier trial history.

The expected counts are 10, 12, and 14. The residuals are therefore \(13-10=3\), \(15-12=3\), and \(17-14=3\). The predictable variances are \(20(0.50)(0.50)=5\), \(20(0.60)(0.40)=4.8\), and \(20(0.70)(0.30)=4.2\). Hence \(S=3+3+3=9\) and \(V=5+4.8+4.2=14\), giving the rough standardized value \(9/\sqrt{14}=2.405\).

A standard-normal two-sided approximation would give a p-value of about 0.0162. This is a screening result, not a definitive finding: the approximation depends on conditions that may be weak with only 60 assignments, and it is not obtained by conditioning on the realized adaptive probability path. The repeated positive residuals are a reason to check the probability logs, implementation, and prespecified analysis. They do not alone prove bias or identify its cause.

Assessing Persistence Without Overreading a Signal

A sustained pattern is more informative than an isolated large residual, but visual persistence is not automatically statistically surprising. If many bins are inspected, some will appear unusual by chance. The analyst should define bins and any overall contrast before looking for a pattern when feasible. A global sum \(S=\sum_i(A_i-\pi_i)\) can detect overall excess or deficit, but positive and negative periods can cancel. Bin-specific residuals help reveal such cancellation, while repeated inspection increases the risk of false alarms.

For a formal assessment, one can use martingale-based procedures under their stated conditions or calibrate a statistic under the complete assignment mechanism. For an adaptive rule, valid calibration must preserve the way probabilities depend on available history. It is not enough to hold the observed probability path fixed if that path was itself shaped by earlier assignments. If the rule depends on outcomes, a simulation-based calibration must also represent the relevant outcome-feedback mechanism or use a valid conditional design argument; simply resampling assignments independently from a fixed list of observed probabilities can be wrong.

Compare this sequential approach with two tempting summaries. A raw chi-square comparison of treatment proportions across periods may use the wrong expected proportions when \(\pi_i\) varies, and it may ignore adaptive dependence. The overall arm total, by contrast, can look balanced while temporal residuals run in opposite directions in different periods. Neither summary replaces comparison with the probabilities actually used. Outcome residual plots address whether outcomes show temporal structure; assignment residuals address whether assignments departed from the randomization probabilities. These are related diagnostics, not interchangeable ones.

Diagnostics, Limitations, and a Common Mistake

Before interpreting a pattern, verify that the time bins were not chosen after inspecting the assignments, that every probability corresponds to the correct participant and decision time, and that the recorded value is the probability actually applied—not a target, rounded value, or later recomputation. Check for missing assignments, duplicate records, changes in eligibility or assignment rules, and periods with probabilities near zero or one. When \(\pi_i\) is near an endpoint, \(\pi_i(1-\pi_i)\) is small: few assignments in that arm may be entirely expected, and standardized diagnostics can become unstable if the total variance is small.

A departure can arise from ordinary random variation, a data or logging error, implementation differing from the protocol, a misspecified account of the algorithm, or another operational change. A statistical signal does not identify which explanation is correct. Nor does a lack of signal prove that allocation was unbiased in every relevant sense. These diagnostics assess a specified assignment mechanism and a specified pattern; they do not establish that calendar-time differences in outcomes are absent or that an estimated treatment effect is free of bias.

Common mistake: “The treatment share rose over time, so randomization failed.” This reasoning treats equal treatment proportions in every period as the benchmark. The correction is to compare each assignment with its pre-assignment probability. A rising share can follow a deliberate, correctly implemented change in \(\pi_i\), as in the second worked example. A persistent positive residual relative to \(\pi_i\) is more concerning, but remains a diagnostic signal rather than proof of bias.

Key takeaway: To distinguish ordinary random imbalance from a possible allocation shift, compare assignments with the sequential probabilities that governed them. Track both the intended probability pattern and the residual pattern, respect adaptive dependence in inference, and treat unusual diagnostics as prompts for investigation—not verdicts.

Check Your Understanding

For each question, identify what the calculation does and does not support.

  1. A bin has 30 assignments, all made with \(\pi_i=0.40\), and 15 go to the treatment arm. Find the residual, predictable variance, and standardized diagnostic.
  2. Across two periods, the treatment probabilities are 0.30 and 0.70, with 10 assignments in each. The observed treatment counts are 3 and 7. Is the change in observed share a residual shift?
  3. Explain why \(V=\sum_i\pi_i(1-\pi_i)\) should not generally be described as the variance conditional on the full realized probability path.
  4. Why can a raw comparison of arm proportions across time be misleading in an adaptive trial?

Solutions. (1) The expected count is \(30(0.40)=12\), so \(S=15-12=3\). The predictable variance is \(30(0.40)(0.60)=7.2\), and the standardized diagnostic is \(3/\sqrt{7.2}=1.118\). This is a modest positive departure, not proof of a problem. (2) The expected counts are \(10(0.30)=3\) and \(10(0.70)=7\); both residuals are zero. The observed share changes as intended, with no departure in these counts. (3) In an adaptive design, the realized probability path may depend on earlier assignments. Conditioning on that path can therefore reveal information about those assignments and alter the residual distribution. \(V\) is the predictable variance used in martingale-based inference, subject to its conditions. (4) Raw proportions ignore that intended probabilities may vary over time and may also ignore dependence induced by adaptive assignment. Compare observed assignments with the probabilities applied before them.

Clinical Biostats