Monte Carlo simulation: one run is vivid and still an anecdote

Watch one seeded run of a two stage delay chain finish on a specific day, and the day feels like the answer. Beside it, the same experiment repeated fills in a histogram, and the tightens as the runs accumulate. The vivid run keeps sitting wherever it happened to land.

Live result
One run of this experiment finished in 4 days, and one run carries no interval at all.
  • stage one, the papers1 day
  • stage two, the road3 days
  • true mean of the experiment6.75 days
A sample of one has nothing to measure a spread across, and that mean is known only because the experiment is small enough to count by hand.
One run of this experiment finished in 4 days, and one run carries no interval at all.A sample of one has nothing to measure a spread across, and that mean is known only because the experiment is small enough to count by hand.

The run you watched

One seeded runSeed 4021, run 1. Papers cleared in 1 day, the inland leg took 3 days, the chain finished in 4 days.

Every run of the same experiment

Every run of the same experimentOne run of this experiment finished in 4 days: 1 on the papers and 3 on the road. One run carries no interval at all, because a sample of one has nothing to measure a spread across. The true mean of this experiment is 6.75 days, which the page can print because the experiment is small enough to count by hand. Ten possible finishes from 3 to 12 days. Eleven days cannot occur. The true mean is 6.75 days.One run, so no interval.
The run you watched4 days
Mean of the runs4.00 days
Interval, 95 per centnone, one run
none, one run
Spread of the runsnone, one run
The true mean6.75 days

Try a run

1

What the seed does and does not buy

A seed buys reproduction and nothing else. Type the same integer and you get the same draws, the same two stages, the same finish and the same picture, on this machine and on any other, today and next year. That is worth a great deal: a run nobody can reproduce cannot be inspected, argued with, or checked against a change you made to the model. The seed is typed in the controls and recorded with the model details.

What it does not buy is evidence. Reproducing a run recovers one path through the model; it says nothing about how the model behaves across the paths it did not take this time. The two are separate properties and it is easy to feel that the first has delivered the second, because a reproducible run has the texture of a fact. The seed on this page is honoured exactly: it is printed, it is typed rather than hidden, and it still leaves the number underneath it an anecdote.

Reproduction also depends on how random draws are assigned. A seed only reproduces a run if every part of the model draws from a declared stream, because adding one draw in one place shifts everything downstream of it. This model has two stages and two streams, as the model details state. A seed printed without its stream map is a promise that quietly stops being true the first time the model changes.

Why the interval and the spread are different questions

Two numbers on this page look similar and answer opposite questions. The spread of the runs, around 2.4 days here, describes the experiment: it is how much one consignment differs from the next, and it barely moves however many runs you do, because it is a fact about the world rather than about your effort. The half width of the interval, which starts at a full day and falls to a seventh of one, describes your estimate: it is how precisely you have pinned down the average, and it shrinks with the square root of the runs.

Confusing them is the most expensive mistake available here. An interval of six and a half to seven days does not mean consignments arrive between six and a half and seven days. Consignments in this model arrive between three and twelve, and exactly one in sixteen takes twelve. The interval is a statement about the mean, and a customer never receives the mean.

Which of the two matters depends on the question. If the decision is about the total across a year of shipments, the mean is what governs and the interval is the right thing to tighten. If the decision is a promise about one shipment, tightening the interval improves nothing that the customer will ever experience, and the number to look at is the tail of the histogram rather than the band above it.

Here is the maths

Basis
Two stage delay chain
Distribution
stage 1 {1,2,3,5}, stage 2 {2,3,4,7}, equal weights
Seed
4021
Replications
1 replication
Model version
1

The formula, in words

  • One run is an observation, not an answer. Each run draws one value for each stage and adds them, producing one of ten possible finishes. A single run carries no information about how far the other runs would have spread, so no estimate and no interval can be built from it.
  • The mean estimates, and the half width says how precisely. Average the run totals for the sample mean; divide the sum of squared deviations by the run count less one and take the root for the sample standard deviation; divide that by the square root of the run count for the standard error; multiply by the t multiplier at 95 per cent for the half width.
  • Four times the runs buys half the interval. The standard error falls with the square root of the run count rather than with the count, so the half width falls from 1.02 to 0.48 to 0.24 days across 25, 100 and 400 runs. Sixteen times the computation for a quarter of the interval, and that ratio does not improve by trying harder.
  • The spread is not the interval. The standard deviation describes how much consignments differ from each other and does not shrink as runs accumulate. The interval describes how precisely the mean has been pinned down and does nothing else. The first is a fact about the world, the second is a fact about your effort.
  • independent, one stream per stage
  • each run starts empty
  • both stages complete

A worked example

The experiment, by hand. Stage 1 averages 1+2+3+54=2.75\frac{1+2+3+5}{4}=2.75 days. Stage 2 averages 2+3+4+74=4.00\frac{2+3+4+7}{4}=4.00 days. The finish averages 6.75 days, and because the draws are independent the variances add: 2.1875+3.5=5.68752.1875 + 3.5 = 5.6875, so the true standard deviation is 5.6875=2.3848\sqrt{5.6875} = 2.3848 days. Both are exact. Nothing was simulated to get them.

The one run. Seed 4021, run 1. Stream A emits 0.090384; ⌊0.090384×4⌋=0\lfloor0.090384\times4\rfloor=0, so stage 1 takes 1 day. Stream B emits 0.315320; ⌊0.315320×4⌋=1\lfloor0.315320\times4\rfloor=1, so stage 2 takes 3 days. The chain finishes in 4 days.

Four days is 2.75 days below the true mean, which is 41 per cent low and 1.15 true standard deviations out. It is not a freak: across a thousand runs, 192 finish in 4 days or fewer. A run that ordinary, watched once, is wrong by two fifths.

The interval at three replication counts, every step shown.

n=25n = 25n=100n = 100n=400n = 400
sample mean5.966.356.71
sample standard deviation2.472.442.48
standard error, sdn\frac{\mathrm{sd}}{\sqrt{n}}2.47÷5=0.49492.47 \div 5 = 0.49492.44÷10=0.24432.44 \div 10 = 0.24432.48÷20=0.12412.48 \div 20 = 0.1241
t multiplier2.0641.9841.966
half width2.064×0.4949=1.022.064 \times 0.4949 = 1.021.984×0.2443=0.481.984 \times 0.2443 = 0.481.966×0.1241=0.241.966 \times 0.1241 = 0.24
interval4.94 to 6.985.87 to 6.836.47 to 6.96
contains 6.75yesyesyes

The law, watched twice. Twenty five runs to one hundred is four times the work, and the half width falls from 1.02 to 0.48, a factor of 2.11. One hundred to four hundred is four times the work again, and it falls from 0.48 to 0.24, a factor of 1.99. Four times the runs buys half the interval, and nothing buys better than that by replication alone. Going from twenty five runs to four hundred is sixteen times the computation for a quarter of the interval, and it moved the sample mean from 5.96 to 6.71, which is to say the estimate was never the thing that was improving quickly.

Where the vivid run was the whole time. At every one of the six replication counts, the interval contains the true mean of 6.75. At every one of them, the run the visitor watched sits at 4 days, outside every interval from n=25n=25 onward. The run was never wrong and it was never evidence. Those are different failures and only one of them is fixable by watching more carefully.

The seed does not move the answer. Seed 31337 draws 0.704391 and 0.929328 on its first run, giving 3 days and 7 days for a finish of 10 days, which is 48 per cent above the true mean where seed 4021's was 41 per cent below. The two vivid runs are 4 days and 10 days, a spread of two and a half times, from the identical model. At a thousand runs the two seeds give means of 6.67 and 6.74, intervals of 6.52 to 6.81 and 6.59 to 6.89, and both contain 6.75. Change the seed and the story changes completely while the answer does not move at all.

Check it yourself

type 31337 into the seed and leave the replications at one. The first run finishes in 10 days instead of 4, from an experiment in which nothing changed. Now take both seeds to 1,000 runs: 4021 gives a mean of 6.67 and 31337 gives 6.74, and both intervals contain 6.75.

What this does not model

dependence between the two stages, which is a model component rather than a footnote and which this model declares as independent because it is; a common shock delaying both stages together, which independent sampling understates; any uncertainty about the model's structure or about the four outcomes in each set, which the sample variance measures nothing about and which no number of runs would reduce; variance reduction of any kind, including antithetic inputs, control variates, conditioning and stratification, each of which buys precision more cheaply than replication and none of which appears here; common random numbers and the paired comparison of two policies, which is the natural next page and which can increase variance rather than reduce it when matching goes the wrong way; warmup, steady state and any non terminating design, this experiment terminating when both stages finish; continuous distributions, fitted families and the question of which family the data supports; and any real shipment, route, operation or cost, none of which this experiment describes.

The delay chain on this page is invented and deliberately tiny: two stages, four outcomes each, chosen so that the true mean and the true spread can be worked out by hand and printed beside the estimates. In any real study that true mean is the unknown, which is why the interval is the only honest report and why this page shows one at every replication count above the first. The generator, the seed and both streams are stated in full so any run here can be reproduced exactly. Nothing about this experiment describes any real shipment, route or operation.