Tutorials › Bayesian Clinical Trials › Variance Reduction With Common Random Numbers in Bayesian Trials

Sample Size, Power and Assurance · Tutorial 251 of 696

Variance Reduction With Common Random Numbers in Bayesian Trials

Use matched simulation replicates to compare Bayesian trial assurance more precisely, while checking that each design retains its correct marginal simulation distribution.

Advanced 13 min read

What You'll Learn

  • Define a paired Monte Carlo estimate of the difference in assurance between two designs.
  • Derive how the covariance between matched success indicators affects Monte Carlo variance.
  • Couple simulations across sample sizes and allocation ratios without changing either design’s marginal distribution.
  • Calculate and interpret a Monte Carlo standard error for a paired assurance difference.
  • Recognize negative covariance, invalid coupling, and other situations in which common random numbers may mislead.

Why Pair Assurance Simulations?

A design decision often depends on comparing assurance under two candidate designs: for example, a total sample size of 160 versus 200, or a 1:1 treatment-control allocation versus a 2:1 allocation. Assurance is the prior-averaged probability of satisfying the specified success rule, so it can be estimated by simulating the design parameters and trial data, then recording whether each simulated trial succeeds. When two assurances are estimated separately, random variation in both estimates contributes to the uncertainty in their difference.

Common random numbers (CRN) aim to reduce that uncertainty by matching simulation replicates across the two designs. Each matched pair uses the same draws for shared sources of randomness, such as the design-prior parameters, while each design is still evaluated using its own sample size, allocation, analysis, and success rule. The comparison then depends on the variation in the paired difference, rather than on two unrelated sets of simulated outcomes.

This is a simulation technique, not a change to the trial model or to the definition of assurance. It is useful when the target is a contrast between designs. It does not necessarily improve the precision of either assurance estimate considered on its own.

Paired Estimation and Its Variance

Definition: Let \(Y_{Am}\) and \(Y_{Bm}\) be the success indicators for candidate designs A and B in matched simulation replicate \(m\). Each indicator is 1 if its simulated trial meets that design’s success rule and 0 otherwise. If the marginal simulation for each design is correct, then \(E(Y_{Am})=q_A\) and \(E(Y_{Bm})=q_B\), where \(q_A\) and \(q_B\) are the designs’ assurances. The paired estimator of the assurance difference is \(\hat{\Delta}=\frac{1}{M}\sum_{m=1}^{M}(Y_{Am}-Y_{Bm})\), which estimates \(\Delta=q_A-q_B\).

The crucial requirement is that matching must not change either design’s marginal distribution. For example, using the same draw of a treatment-effect parameter for both designs is valid when that parameter is drawn from the same design prior in both simulations. The designs can then use that shared draw but apply their respective sample sizes, allocation ratios, likelihoods, and Bayesian success criteria. A coupling is simply a way of generating the two design outcomes together; it must leave each design’s standalone simulation valid.

Suppose the \(M\) matched pairs are independent and identically distributed. The variance of one paired difference follows from the variance formula for a difference:

$$ \operatorname{Var}(Y_A-Y_B) = \operatorname{Var}(Y_A)+\operatorname{Var}(Y_B) -2\operatorname{Cov}(Y_A,Y_B). $$

The paired estimator averages \(M\) independent differences, so its variance is the variance above divided by \(M\). Positive covariance reduces the variance; negative covariance increases it. Since each outcome is an indicator, \(\operatorname{Var}(Y_A)=q_A(1-q_A)\) and \(\operatorname{Var}(Y_B)=q_B(1-q_B)\). The covariance is determined by the chosen coupling, not by the two assurances alone.

$$ \operatorname{Var}(\hat{\Delta}) = \frac{ q_A(1-q_A)+q_B(1-q_B)-2\operatorname{Cov}(Y_A,Y_B) }{M}. $$

In practice, calculate \(D_m=Y_{Am}-Y_{Bm}\) for each pair. The Monte Carlo standard error (MCSE) of \(\hat{\Delta}\) is estimated by \(s_D/\sqrt{M}\), where \(s_D\) is the sample standard deviation of the \(M\) paired differences. This standard error quantifies simulation error in the estimated assurance difference. It is not a posterior standard deviation for a treatment effect, nor does it describe uncertainty about the clinical model or design prior.

The logic of the variance benefit is immediate from the formula: a coupling with positive covariance subtracts a positive quantity from the variance of the difference. In contrast, calculating two separate MCSEs and treating the estimates as independent omits the covariance term. That calculation can overstate or understate the actual simulation error of the paired contrast.

Constructing a Valid Coupling

For different sample sizes, a natural coupling is to simulate a sufficiently long sequence of potential observations for each arm and let each design use the number it requires. For different allocation ratios, use shared treatment-arm draws across designs and shared control-arm draws across designs, with the number used from each arm determined by each allocation. Use independent random streams for treatment and control within a simulated trial if the assumed data-generating model makes the arms independent. The shared streams are across candidate designs, not a reason to make the two arms dependent within a trial.

For binary outcomes, a shared uniform draw provides a simple construction. If an outcome has probability \(p\), generate \(U\sim\operatorname{Uniform}(0,1)\) and set the outcome to 1 when \(U<p\), and to 0 otherwise. For two designs with probabilities \(p_A\) and \(p_B\), using the same \(U\) for corresponding observations preserves each Bernoulli marginal. When \(p_A\) and \(p_B\) are close, the outcomes often agree, which can create positive covariance.

At the outer level of an assurance simulation, the same design-prior draw and any shared nuisance-parameter draws can be used for both designs. At the inner level, use a coupling that preserves the data-generating distribution under each design. Each simulated trial must then be analyzed under its own design and evaluated against its own specified success rule. A shared random number cannot justify applying one design’s posterior calculation or decision threshold to the other.

Worked Example: Nested Sample Sizes With Shared Uniforms

Consider two candidate designs with 4 and 5 participants in one arm for a single simulation replicate. Conditional on a hypothetical design-prior draw, suppose that arm’s response probability is \(p=0.40\). Generate five independent uniform values for the arm: \(0.12, 0.73, 0.31, 0.91, 0.38\). Use the first four values for the smaller design and all five for the larger design.

For each value, the simulated response is 1 if \(U<0.40\), and 0 otherwise. The five outcomes are therefore \(1,0,1,0,1\). The smaller design has 2 responses among 4 participants; the larger design has 3 among 5. Each simulated outcome has the required Bernoulli probability, and the smaller data set is nested within the larger one.

The response counts alone do not determine whether either trial meets a Bayesian success rule; that requires applying the specified analysis to each design’s data. For assurance estimation, repeat the construction across independent replicates, drawing the design-prior parameters as required and applying the full analysis and success criterion separately at each sample size. The shared sequence provides a valid pairing because the outcomes used by either design have the correct marginal distribution.

Worked Assurance Comparisons

Worked Example: Comparing Two Sample Sizes

Suppose 1,000 matched simulation replicates compare a smaller design A with a larger design B. Design A succeeds in 620 replicates and B succeeds in 600. In 120 replicates only A succeeds, and in 100 only B succeeds. Thus, 500 replicates succeed under both designs, while 280 succeed under neither. The marginal success counts are consistent: A has \(500+120=620\) successes, and B has \(500+100=600\).

The estimated assurances are \(\hat q_A=620/1000=0.620\) and \(\hat q_B=600/1000=0.600\). Their estimated difference is \(0.0200\), or 2.00 percentage points in favor of A in this simulation. For each pair, \(D_m\) is 1 for an A-only success, -1 for a B-only success, and 0 otherwise. Therefore \(\sum D_m=120-100=20\), and \(\sum D_m^2=120+100=220\).

The sample variance of the paired differences is

$$ s_D^2 = \frac{220-1000(0.0200)^2}{999} = \frac{219.6}{999} = 0.2198. $$

The estimated paired MCSE is \(s_D/\sqrt{M}=\sqrt{0.2198/1000}=0.01483\). Thus, the estimated difference of 0.0200 has a simulation standard error of about 0.0148, or 1.48 percentage points. A rough normal Monte Carlo interval is \(0.0200\pm1.96(0.01483)\), which is approximately \((-0.0091,0.0491)\). This interval describes Monte Carlo uncertainty in the difference, not a probability statement that the true assurance difference lies in the interval.

For comparison, treating the estimates as independent gives an approximate MCSE of \(\sqrt{[0.620(0.380)+0.600(0.400)]/1000}=0.02181\). The matched outcomes share 500 successes, producing positive covariance and a smaller paired MCSE. The paired estimate is the appropriate error calculation for this paired simulation.

Worked Example: Comparing Allocation Ratios

Now compare two allocations using \(M=2{,}000\) matched replicates: design A allocates more participants to treatment, while design B uses a 1:1 ratio. Suppose A succeeds in 1,440 replicates and B in 1,360. Of these, 140 are A-only successes and 60 are B-only successes, so 1,300 succeed under both and 540 under neither. These counts sum to the stated marginal totals.

The estimated assurances are \(0.720\) and \(0.680\), giving \(\hat{\Delta}=0.0400\), or 4.00 percentage points. The paired differences sum to \(140-60=80\); their squared values sum to \(140+60=200\). Hence

$$ s_D^2 = \frac{200-2000(0.0400)^2}{1999} = \frac{196.8}{1999} = 0.09845, \qquad SE(\hat{\Delta})=\sqrt{\frac{0.09845}{2000}}=0.007016. $$

The paired MCSE is about 0.702 percentage points. The independent-estimate calculation would give \(\sqrt{[0.720(0.280)+0.680(0.320)]/2000}=0.01448\), about 1.45 percentage points. Here the many shared success outcomes make the paired differences less variable. The estimated advantage for A is a simulation estimate; deciding whether it is clinically or operationally important requires considering the design objectives as well.

Diagnostics, Alternatives, and Limitations

Common random numbers should be checked empirically rather than assumed to help. Inspect the frequencies of the four paired outcomes: success under both, failure under both, A-only success, and B-only success. Many matching outcomes often indicate positive association, but the decisive diagnostic is the observed variance of \(D_m\), or its comparison with the variance expected from independent simulation. Report the paired MCSE for the contrast and retain the two marginal assurance estimates so that the comparison can be audited.

A coupling can produce negative covariance. For example, imagine 1,000 pairs where each design succeeds in 500 replicates, but 450 pairs are A-only successes and 450 are B-only successes; 50 pairs succeed under both and 50 fail under both. Each estimated assurance is 0.500, but the paired difference is nonzero in 900 replicates. Its sample variance is \(900/999=0.9009\), giving an MCSE of \(\sqrt{0.9009/1000}=0.03002\). The independent-estimate MCSE would be \(\sqrt{[0.25+0.25]/1000}=0.02236\). Pairing has made this contrast less precise, not more precise.

Independent simulation is the main alternative: simulate each candidate design separately and estimate its assurance and MCSE. It is simple, but a contrast based on independent runs has no matched covariance benefit. Exact or deterministic calculation is another alternative when the design and model make it feasible; simulation is then not necessary for that calculation. The earlier material on Monte Carlo error for assurance estimates discusses simulation error for assurance estimates themselves; for a design contrast, the paired differences supply the relevant simulation-error calculation.

Several failure modes deserve attention:

  • Changing a marginal distribution. Reusing draws is not valid if it gives either candidate design the wrong prior, likelihood, sample size, or outcome distribution. Verify each design’s marginal simulation recipe independently.
  • Sharing draws across independent trial arms. If treatment and control outcomes are assumed independent conditional on parameters, use independent draws between arms within each replicate. Match treatment-arm draws across designs and control-arm draws across designs instead.
  • Using separate estimates but a paired standard error. The paired MCSE requires a stored, correctly aligned \(D_m\) for every replicate. Marginal success totals alone do not reveal the covariance.
  • Assuming CRN always improves precision. The sign and size of the covariance depend on the coupling and the success rules. Compare the paired-difference variability with the independent benchmark.
  • Overinterpreting a small estimated difference. A difference may be small relative to its MCSE. Increase the number of paired replicates if simulation error is too large for the design decision, and do not confuse Monte Carlo precision with uncertainty from the prior or model assumptions.

The method is especially natural for nearby sample sizes or allocations, because shared parameter draws and nested observations can make simulated performance indicators move together. However, the success indicator is a thresholded result of a full Bayesian analysis; nearby designs do not guarantee a high correlation between indicators. The benefit must be judged from the paired simulation output.

Key takeaway: To compare assurance, estimate the mean of matched replicate differences and calculate its MCSE from their sample standard deviation. Common random numbers improve precision only when the coupling preserves each design’s marginal distribution and induces sufficiently positive covariance between success indicators.

Check Your Understanding

Answer each question, then check the solutions below.

  1. In 800 matched replicates, A-only successes occur 70 times and B-only successes occur 50 times. What is the estimated assurance difference?
  2. Why can shared treatment-arm draws be valid across two allocation designs while shared treatment and control draws within a trial may be invalid?
  3. Two designs each have estimated assurance 0.50. In 1,000 pairs, 300 are A-only successes and 300 are B-only successes, with all other pairs either both succeeding or both failing. Calculate the paired MCSE of the difference.
  4. What must be checked before interpreting a smaller paired MCSE as evidence that CRN helped?

Solutions. 1. The paired differences sum to \(70-50=20\), so \(\hat{\Delta}=20/800=0.0250\), an estimated 2.50 percentage-point advantage for A. 2. Sharing treatment draws across designs couples the candidate simulations without changing the treatment-arm marginal distribution in either design. If treatment and control are assumed independent within a trial, sharing a draw between those arms creates dependence and fails to reproduce the assumed joint data distribution. 3. The paired differences are 1 in 300 pairs, -1 in 300, and 0 in 400. Their mean is 0 and their sample variance is \(600/999=0.6006\), so the MCSE is \(\sqrt{0.6006/1000}=0.02451\). 4. Verify that each design’s marginal prior and data-generating distribution remain correct, and compare the paired-difference variance with the independent benchmark. Positive covariance, not the mere use of shared random numbers, is what reduces variance.

Clinical Biostats