Why Monte Carlo Standard Errors Matter
A simulation estimates how a MAMS design behaves across repeated hypothetical trials. For example, it may estimate the probability of declaring at least one treatment effective under a specified treatment-effect scenario, or the expected total number of participants recruited before the trial stops. These estimates vary from one set of simulation runs to another, even when the code and scenario are unchanged. A Monte Carlo standard error (MCSE) quantifies this simulation-to-simulation variability.
The unit of analysis is a complete simulated trial, also called a replicate. Patients within one simulated trial are not separate Monte Carlo replicates. This distinction is especially important in MAMS simulations: outcomes may be dependent within a trial because of shared controls, interim decisions, or common stopping rules. That within-trial dependence is part of the design being simulated. For the standard MCSE formulas below, the complete trial replicates must themselves be independent and identically distributed under the specified simulation scenario.
Monte Carlo Error for a Simulated Probability
Suppose the target is the probability \(p\) of a clearly defined event under a fixed scenario. The event might be that at least one experimental arm is declared successful, or that any true-null arm is declared successful. For replicate \(r\), define \(Z_r=1\) if the event occurs and \(Z_r=0\) otherwise. Then \(Z_r\) is a Bernoulli outcome with probability \(p\), and the simulated probability estimate is the proportion of replicates in which the event occurred.
Here \(K\) is the number of event-positive replicates. The approximation sign indicates that the unknown \(p\) in the standard deviation formula is replaced by its estimate \(\hat p\). The resulting MCSE is on the probability scale: for example, 0.01 corresponds to one percentage point. It is not the standard deviation of patient outcomes, and it is not a measure of uncertainty about whether the scenario or model is appropriate.
Why the formula has this form
Under the stated assumptions, each \(Z_r\) has mean \(p\) and variance \(p(1-p)\). Independence means that the variance of their average is the variance of one indicator divided by \(R\). Taking the square root gives the standard deviation of \(\hat p\); substituting \(\hat p\) for the unknown \(p\) gives the plug-in MCSE.
This derivation depends on independent, identically distributed replicate indicators. Dependence among patients or arms within one replicate does not invalidate it: those data determine the single value \(Z_r\). Dependence between replicate indicators, such as inadvertently reusing the same random-number stream in a way that couples runs, can invalidate the variance calculation.
Worked Example: Monte Carlo Error for Simulated Power
In a hypothetical MAMS simulation under one specified treatment-effect scenario, \(R=2{,}000\) complete, independently generated trials are run. The event is “at least one experimental arm is declared successful.” This is a replicate-level binary outcome, so the probability estimator and Bernoulli MCSE formula apply.
The event occurs in \(K=286\) trials. Thus
The estimated Monte Carlo standard error is
The estimated probability of at least one successful declaration is 0.143, or 14.3%, with an MCSE of about 0.00783, or 0.783 percentage points. The MCSE describes the typical simulation-to-simulation variation of the estimate at this replicate count; it does not mean there is a 0.783% probability that the design’s true power is wrong by that amount.
Monte Carlo Error for Mean Sample Size
Expected sample size is estimated from one total per simulated trial. Let \(N_r\) be the total number of participants recruited in replicate \(r\), including participants from all arms and stages according to the protocol’s definition. If the target is \(E(N_r)\), the estimate is the average across the \(R\) trial totals. The standard error of that average is estimated using the sample standard deviation of those totals.
The MCSE is in the same units as the outcome: if \(N_r\) is a participant count, then \(\bar N\), \(s_N\), and its MCSE are all measured in participants. This formula estimates the variability of the replicate average under independent, identically distributed trial totals with finite variance. It does not require the trial totals themselves to be normally distributed for the calculation, although with very few replicates the estimated standard deviation may be unstable.
Worked Example: Monte Carlo Error for Expected Sample Size
Suppose six hypothetical, independently simulated MAMS trials produce total sample sizes of 312, 280, 355, 301, 292, and 340 participants. Assume all six trials completed the same simulation procedure and that the total is defined consistently in every replicate.
The estimated expected sample size is
The deviations from the mean are approximately \(-1.333\), \(-33.333\), \(41.667\), \(-12.333\), \(-21.333\), and \(26.667\) participants. Their squared deviations sum to approximately \(4{,}167.333\) participant-squared, giving
Therefore,
The estimated mean total sample size is about 313 participants, and its estimated MCSE is about 11.8 participants. Six replicates make this a useful calculation demonstration, not a claim that the estimate is precise enough for a design decision. With more independent replicates, the estimated MCSE will generally be more stable.
How to Calculate and Check the MCSE
A reliable calculation begins by defining the estimand and the replicate-level outcome before summarising the simulation output. In particular, decide what counts as an event, or precisely which participants contribute to a sample-size total. Then check that every included row represents one complete replicate from the same scenario and simulation procedure.
Name the operating characteristic and scenario, such as the probability of any false declaration under a partial-null configuration, or the expected total recruited sample size under an alternative configuration.
Record a zero-or-one indicator for an event probability, or one numeric total for a mean. Do not treat individual patients, arms, or interim looks as independent replicates.
For an event, use \(\hat p=K/R\) and \(\sqrt{\hat p(1-\hat p)/R}\). For a mean, calculate \(\bar N\), the replicate-level sample standard deviation \(s_N\), and \(s_N/\sqrt{R}\).
Confirm the number of valid replicates, inspect the event count or spread of replicate outcomes, and report the MCSE on the same scale and in the same units as its estimate.
For an event probability, the sample standard deviation of the indicators can also be used: \(s_Z/\sqrt{R}\), where \(s_Z\) is their sample standard deviation. This uses the usual \(R-1\) divisor and differs slightly from the plug-in formula \(\sqrt{\hat p(1-\hat p)/R}\). The latter is the customary binomial plug-in MCSE; the difference is negligible for large \(R\).
Diagnostics, Comparisons, and Limitations
Useful checks concern both the simulation output and the assumptions behind the formula. Verify that the replicate count \(R\) is the number of complete trials, not the number of patients or the number of arm-stage records. Check for duplicated outcomes, unrecorded failures, or replicate totals computed with inconsistent rules. A code failure should not be silently omitted if it changes which trials enter the estimate; resolve the failure or define and justify the target population of valid runs.
The formulas are for independent replicates drawn under one fixed scenario. If simulation runs are intentionally coupled—for example, to compare two designs using shared random numbers—the two estimates may be dependent. For a comparison, calculate the variability of the replicate-level differences, rather than treating the two sets of estimates as independent. Likewise, if a simulation averages over randomly drawn scenarios, its replicate outcome targets that mixture of scenarios; it does not automatically estimate the operating characteristic at any one fixed scenario.
When an exact or analytic calculation is available and represents the same operating characteristic, it avoids Monte Carlo sampling error and can serve as a useful comparison. Simulation remains valuable when adaptive decisions, multiple arms, and shared controls make direct calculation difficult. In either case, the target and assumptions must match. An analytic result for a simplified design does not verify a simulation of a different design.
MCSEs measure only the finite-replication variability conditional on the code, scenario, and probability model used. They do not reveal misspecified treatment effects, incorrect randomization logic, a programming error that is repeated consistently, or uncertainty about which scenario is clinically relevant. A small MCSE therefore does not establish that a simulation is valid or that its assumptions are realistic.
A second warning sign is a reported MCSE of zero. For the probability formula, this happens when every replicate has the same indicator value, including when no event occurs. It means that the plug-in estimate has no observed variation; it does not establish that the underlying probability is exactly zero or one. Similarly, a sample-size MCSE of zero from identical replicate totals warrants checking the simulation and the recorded outcome. Inspect the replicate-level data and event counts rather than interpreting a degenerate estimate as proof of certainty.
Check Your Understanding
Try each question, then compare your reasoning with the solutions below.
- A simulation has 1,500 independent complete trials, and an event occurs in 225. Calculate the estimated probability and its MCSE.
- For each replicate, a MAMS simulation records whether any true-null arm was declared successful. Why is the replicate-level outcome an indicator even if several arms and interim looks contributed to the decision?
- Four hypothetical trial totals are 180, 200, 220, and 200 participants. Calculate the mean sample size and its MCSE.
- All 2,000 replicates have an event indicator of zero. What does the plug-in MCSE equal, and what should you conclude?
Solutions. (1) \(\hat p=225/1{,}500=0.150\). Its MCSE is \(\sqrt{0.150(0.850)/1{,}500}=\sqrt{0.000085}=0.00922\), or about 0.922 percentage points. (2) The target event is defined once for each complete trial: it is one if at least one true-null arm is declared successful and zero otherwise. The arms and looks within a trial determine that single outcome; they are not independent replicates. (3) The mean is \(\bar N=(180+200+220+200)/4=200\) participants. The deviations are \(-20,0,20,0\), so \(s_N=\sqrt{(400+0+400+0)/3}=\sqrt{266.667}=16.33\) participants. Thus the MCSE is \(16.33/\sqrt{4}=8.165\) participants. (4) The plug-in MCSE is \(\sqrt{0(1-0)/2{,}000}=0\). This is a degenerate estimate based on no observed events, not evidence that the target event probability is truly zero; the event count and simulation should be examined carefully.