Your first simulationLesson 04 of 76 · 7 min

See the outcomes before the headline

Read an outcome distribution and distinguish quantiles from a mean.

A histogram groups values into bins, intervals whose bar heights count observations. The ten delivery delays below are invented values in days. Most are small, with one large delay: a long right tail. We can learn to summarise that shape without first choosing a random-input distribution.

The mean is total delay divided by ten. The median, or P50, is the middle of the sorted values; here the fifth and sixth values are both 3 days. A quantile is a cutoff for a stated fraction. P90 means roughly 90% of outcomes are at or below the cutoff.

NumPy's default linear interpolation puts P90 one tenth of the way from the ninth value, 5, to the tenth, 15: 6 days. That cutoff need not be an observed delay. These percentiles describe the supplied outcomes, not uncertainty about an estimated mean. Keep the raw values beside the picture because changing bins can change its appearance.

A tail can move the mean
0.724.4811.615.300.571.11.72.3Invented delaysDelivery delay (days)
0.724.4811.615.300.571.11.72.3Invented delaysDelivery delay (days)
Reference illustration. Ten invented delivery delays over their full range. Most values are small; the one long delay lifts the mean above the median. The lines mark median 3 and interpolated P90 6 days. These are supplied examples, not simulated or measured evidence.

For a right-skewed distribution, must the mean equal the median?

Write a prediction (optional)

Ten invented delivery delays · inspectable summaries

Select Run Python below with the code unchanged.

Tools
About Python ↗

The code is editable. Press Ctrl+Enter or ⌘+Enter to run Python from the editor.

Published example output

This result comes from the original Python. Your runs appear above. Build environment ↗

INVENTED delivery delays (days): [ 1  1  2  2  3  3  4  4  5 15]
Mean delay (days): 4.0
Median and P90 (days): [3. 6.]
Plot generated from the published Python during the build. Refer to its labelled axes and the text output.
Open full-size figure ↗

Read the first result

Compare Mean delay (days) with the two numbers in Median and P90 (days). The large delay lifts the mean above the median. The published P90 is 6 days. Nine of the ten supplied delays are at or below it.

Try an edit

In the delay array, predict what happens if the last value rises. Replace the final 15 with 30. Select Run Python again. Compare Mean delay (days) and Median and P90 (days). Which summaries move when only the largest delay increases?

Back to the Python editor

Scope. These ten delays are invented examples, not measured data or random draws. They illustrate summaries; they do not establish a delivery-delay model or a reliable future tail.

Try a fresh case

P90 delivery time is eight days. What does that describe?

Choose an answer
Need a hint?
Hint 1

Name whether the quantity concerns outcomes or an estimated average.

Hint 2

Think about the upper 10% of outcomes.

Your notes