Why Simulation Records Matter
A design-assurance result is evidence about a trial design under specified assumptions. A reported operating characteristic, such as a simulated rejection rate, depends not only on the design but also on the scenario inputs, implementation, software environment, and random-number generation. If those details are missing, another analyst may be unable to determine what was run, repeat it, or explain why a rerun differs.
A reproducible record is therefore more than a seed written in a notebook. It connects a result to the exact inputs and computational process that produced it. This is especially important for adaptive trials, where a small implementation or configuration change can alter how interim data trigger a decision and therefore affect the reported design performance.
What a Run Record Should Contain
A useful record separates the specification of a run from its execution and its results. The specification says what should be simulated; execution metadata says how a particular run was carried out; results summarize what it produced. Keeping these distinct makes it possible to identify whether two results came from the same design and settings, even if they used different random-number streams.
- Identity and purpose: a unique run identifier, date and time, responsible analyst or process, and a short description of the design-assurance question.
- Code revision: a version-control commit identifier or an archived source-code snapshot, including any uncommitted changes. A branch name alone is not enough because the branch can move.
- Software environment: programming language and version, relevant package or library versions, operating system, and, when exact numerical agreement matters, details such as processor or numerical-library configuration.
- Scenario inputs: scenario identifiers and all numerical and categorical inputs, with units and conventions. Record both values and their meanings; for example, whether a rate is per patient or per patient-year.
- Random-number configuration: generator or library, seed or initial state, and stream or substream assignments. For parallel runs, record how work was divided and how each worker’s stream was assigned.
- Run settings: replication count, stopping rules, parallel worker count, batching, tolerances, and any options affecting the computation.
- Outputs and status: completion or failure status, output-file locations or identifiers, summary estimates and their units, and any warnings or exceptions.
For an adaptive-trial simulation, scenario inputs might include treatment effects, event rates, accrual assumptions, outcome variability, and the settings that govern interim decisions. Store the actual configuration used, not merely a description such as “the standard scenario.” A clear record also distinguishes a requested setting from the value the software actually used after defaults or overrides were applied.
| Record field | Example entry | Why it matters |
|---|---|---|
| Code revision | Commit identifier plus a clean-working-tree indicator | Identifies the implementation that produced the result |
| Scenario | Scenario ID, event rate per patient-year, treatment effect in stated units | Defines the simulated data-generating conditions |
| Randomness | Generator name, seed, stream assignment | Supports repeatable and traceable random draws |
| Run settings | Replications, workers, batch size, stopping rule | Captures choices that can affect execution or results |
| Output | Rejection count, estimated rate, output-file checksum | Links the reported result to retained files |
Why a Seed Alone Is Not a Reproducibility Record
A simulation’s output can be represented schematically as a function of its code \(C\), environment \(E\), inputs \(I\), random-number setup \(R\), and run settings \(S\):
A seed helps specify \(R\), but it does not specify the other arguments. Even with the same seed, changing the code, scenario, generator implementation, or order in which random numbers are requested can change \(Y\). In parallel computation, a single seed may not determine which stream supplies each task unless the stream assignment and execution strategy are also recorded.
A useful way to understand this is to imagine a deterministic generator that turns an initial state into a sequence of random-number values. The simulation consumes that sequence as it runs. If the code makes an extra random draw in one branch, later draws can be assigned to different simulated quantities. Thus identical initial states do not guarantee identical outputs when the code path or draw order differs.
This representation is a justification for recording the generator, state, code, inputs, and settings together: the result depends on the full computation, not on the seed in isolation. Exact reproduction also depends on whether the relevant software operations behave identically in the environments being compared.
Worked Example: Recording a Simulated Rejection Rate
Suppose a hypothetical design-assurance run simulates 10,000 trials under a specified null scenario. The test rejects in 512 simulated trials. The reported estimated rejection rate is \(512/10{,}000\). What should the record preserve, and what is the result?
Result calculation. Let \(X\) be the number of simulated trials that reject. The observed count is \(X=512\), so the estimated rejection rate is
The estimate is 5.12% of simulated trials. A record should identify the null scenario’s inputs and units, the code revision, the software environment, the random-number generator and seed or state, the number of replications, and the execution settings. It should retain the rejection count and denominator, not just the rounded percentage; the count makes the calculation transparent and checkable.
For context, if the simulated trials are independent Bernoulli outcomes with a common rejection probability, the estimated Monte Carlo standard error is
This is about 0.220 percentage points. The record should make clear that this uncertainty describes Monte Carlo variation under the simulation setup, not uncertainty about the trial’s true treatment effect. The calculation also relies on independent simulated trial outcomes with the same rejection probability; if the run uses a dependent sampling design, this standard error formula may not apply.
Recording Parallel Randomness and Run Settings
Parallel simulation can reduce elapsed time, but it makes random-number provenance more demanding. Random Number Streams for Parallel Simulation established why workers need a controlled stream arrangement rather than an undocumented collection of independently chosen seeds. A reproducible record should retain the generator and stream method, the master seed or initial state, the mapping from workers or tasks to streams, and the parallel settings used for the run.
Suppose a hypothetical simulation uses four workers to generate 20,000 trials. A record that says only “seed 731” leaves open how the 20,000 trials were divided, which stream each worker used, and whether a change in worker count changes task-to-stream assignments. Record those choices explicitly. If results are intended to be stable under changes in worker count, the run design must use an assignment scheme that supports that goal; the record cannot make an unstable assignment stable after the fact.
Worked Example: A Parallel Run With Four Workers
A hypothetical run assigns 20,000 replications in four batches of 5,000. Each worker receives a distinct substream from a documented generator, initialized from master seed 731. What should be recorded to make the random-number setup interpretable?
Record the generator and its software-library version, the master seed 731, the method used to derive or select substreams, and the mapping of workers to substreams. Also record four workers, 5,000 replications per batch, and whether the worker-to-batch assignment is fixed or depends on scheduling.
If the output is a count \(X\) of a specified event, the denominator is \(n=4(5{,}000)=20{,}000\). For example, if a hypothetical run yields \(X=1{,}040\), then
The estimated event rate is 5.20%. The count and denominator are not enough to reproduce the run, but they provide a verifiable summary alongside the configuration. If the four substreams are independent and the simulated trial outcomes are identically distributed, the usual binomial Monte Carlo standard error is approximately
That is about 0.157 percentage points. If stream assignment creates dependence across simulated outcomes, the independence condition would need scrutiny and this calculation might not describe the actual Monte Carlo error.
Reproduction, Regeneration, and Numerical Agreement
“Reproducible” can mean different levels of agreement. Exact regeneration means the same run can be executed from retained inputs and artifacts and produces the same outputs, often bit for bit. Numerical reproduction means the rerun agrees to a stated tolerance. Conceptual reproduction means the same design, scenarios, and analysis are implemented again, but independent code or software may produce different random draws and therefore different Monte Carlo estimates.
These distinctions matter because floating-point calculations can differ slightly across processors, compilers, library versions, or parallel reduction orders. A small numerical discrepancy does not automatically imply a different design. Conversely, a similar final percentage does not establish that the same scenario, code, or run settings were used. The record should state which level of agreement is expected and, where relevant, the tolerance used to compare numerical outputs.
Worked Example: Comparing a Rerun With the Original
A hypothetical original run reports 512 rejections in 10,000 trials, or 0.0512. A rerun using the same recorded configuration reports 519 rejections in 10,000 trials, or 0.0519. Is this evidence that the configuration was not reproduced?
The difference in estimated rates is
or 0.070 percentage points. If the rerun used the same code, environment, inputs, and random-number state and was intended to be an exact rerun, a different count signals that some relevant detail may not have been reproduced or that the computation is not deterministic under the recorded settings. Check the code revision, configuration, generator and state, stream mapping, software versions, and execution options before interpreting the difference.
If instead the rerun used a new random-number stream, a different count is expected from Monte Carlo variation. Under the simplifying assumption of independent Bernoulli outcomes with a common rejection probability near 0.0515, the standard error for the difference between two independent estimated rates is approximately
The observed difference, 0.0007, is smaller than this approximate standard error. That comparison does not prove the runs used the same configuration; it only shows that the difference is not large relative to expected Monte Carlo variation under these assumptions. A record must distinguish a same-stream regeneration check from a new-stream replication.
Practical Integrity Checks and Common Failure Modes
A record is most useful when its pieces can be cross-checked. Use a unique run ID consistently in configuration files, logs, and output files. Preserve the exact configuration file and source revision, and record a checksum or other content identifier for archived artifacts. A checksum can help detect whether a file has changed; it does not explain the file’s contents or prove that the computation was correct.
Before treating a result as independently regenerable, check that the run record answers these questions:
- Can the code revision be retrieved, and are uncommitted changes accounted for?
- Are all scenario inputs, units, defaults, and overrides explicit?
- Are the generator, initial state, and parallel stream assignments specified?
- Are replication counts and stopping or batching rules recorded?
- Can each reported summary be linked to the corresponding output and run ID?
- Is the expected degree of agreement on rerun stated?
A common mistake is to reason, “The seed is recorded, so the result is reproducible.” The correction is that a seed addresses only part of the random-number setup. Without the code revision, scenario values, generator, software environment, and run settings, another analyst may not be able to generate the same sequence, run the same model, or even identify the intended computation.
Another failure is to document only the final estimate. A percentage without the event count, denominator, scenario identity, and run configuration is difficult to audit and may conceal that two results used different settings. Retain both the summarized results and the underlying output or a clearly identified archived artifact, subject to applicable data-governance requirements.
Choosing a Practical Recording Strategy
A manually maintained log can be simple and useful for small exploratory runs, but it is vulnerable to omissions and transcription errors. A machine-generated manifest, created from the configuration and execution environment, can improve completeness and consistency. Neither approach is sufficient by itself if it fails to preserve the source revision, actual inputs, or output links.
Environment capture also involves trade-offs. A package lockfile records package versions and dependencies, while a container or archived environment may capture more of the software stack. These tools improve the chance of re-creating an environment but do not necessarily reproduce hardware behavior, external services, or all system libraries. Store the environment description alongside the run record and specify whether bitwise equality is required or a tolerance-based comparison is acceptable.
The goal is not to record every detail that could ever affect a computer. It is to capture enough information to make the result traceable, make a meaningful rerun possible, and diagnose discrepancies. The appropriate detail depends on the intended use of the result, the computational setup, and the consequences of a mistaken design-assurance conclusion.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions below.
- A report gives a seed and a simulated rejection rate but no code revision or scenario file. Name two important gaps and explain why the seed alone does not resolve them.
- A run has 8,000 replications and 416 simulated rejections. Calculate the estimated rejection rate.
- What additional random-number information should be recorded for a simulation split across several workers?
- Two independent runs use different random-number streams but the same scenario and settings. Must their estimated rates be identical? Explain.
- Give one reason a rerun might fail to match bit for bit even when the recorded simulation logic is unchanged.
Solutions. (1) The code revision and explicit scenario inputs are missing; without them, the implementation and conditions are unknown. A seed does not specify code, inputs, software, or run settings. (2) \(\hat{p}=416/8{,}000=0.0520\), or 5.20%. (3) Record the generator and version, master seed or state, stream or substream method, worker-to-stream assignment, and relevant parallel settings. (4) No. Different streams generally produce different simulated outcomes, so estimates vary through Monte Carlo error even when the target scenario is unchanged. (5) Differences in numerical libraries, hardware, software versions, or the order of parallel floating-point operations can cause small numerical discrepancies.