14
Event-path plots, step plots, distributions and tables
A stochastic result can be technically correct but communicated badly. This lesson matches each biological question to a suitable display and explains what the display does—and does not—show.
Four displays answer four different questions
Event timeline
Question: Which event occurred, and when?
Plot one marker per infection or recovery event at its exact continuous time.
State step plot
Question: How did compartment counts change through one epidemic?
Keep the state constant between irregular jump times.
Multiple sample paths
Question: How different can trajectories be?
Show a manageable subset with transparency, not hundreds of opaque lines.
Outcome distribution
Question: How frequently did different final results occur?
Use all independent runs in a histogram, empirical distribution or probability table.
The fundamental CTMC plotting rule
In Matplotlib, plt.step(..., where="post") implements this right-continuous display.
Tables preserve exact values
Plots reveal patterns; tables provide exact numbers. A useful event table has one row per jump and includes event time, waiting time, event type and post-event state. A useful outcome table has one row per independent trajectory.
| Table | Rows represent | Typical columns |
|---|---|---|
| Event log | Events in one trajectory | Time, waiting time, event, \(S,I,R\) |
| Outcome data | Independent trajectories | Final size, duration, peak, peak time |
| Summary table | Outcome measures | Median, 5th and 95th percentiles |
Interactive Python laboratory
Run the code to create one coherent four-panel report: the event timeline and step path come from one selected epidemic, while the sample-path and distribution panels use many independent epidemics. Exact supporting tables are printed below the code.
Output
Run the code to see the result.
How to read the four panels
- Panel A: event density is high when the total rate is high. The vertical position labels event type; it is not a numerical magnitude.
- Panel B: every vertical jump changes \(I\) by exactly one, while horizontal segments show no change between events.
- Panel C: variation in peak, timing and extinction is visible, but twenty displayed paths are illustrative rather than a probability estimate.
- Panel D: all 300 outcomes contribute. Separate clusters can reveal early fade-outs and major epidemics.
Match the display to the claim
| Claim | Suitable evidence | Unsuitable evidence alone |
|---|---|---|
| Events occur at irregular times | Event timeline or one step path | Outcome histogram |
| Trajectories vary substantially | Multiple paths plus ensemble summaries | One selected path |
| Large outbreaks occur with a given frequency | Count/proportion from all independent runs | Spaghetti plot |
| Median final size has a stated value | Outcome table and marked distribution | Event log from one run |
Presentation checks
- State the number of independent trajectories and the random seed.
- Label whether intervals describe outcomes or Monte Carlo uncertainty.
- Include units on time axes and identify the population quantity.
- Do not hide early extinctions by displaying only large outbreaks.
- Do not use excessive decimal places for inherently noisy estimates.
- Place biological interpretation beside the display, not only code.
Biological interpretation
The selected path explains event order, but it cannot establish what is common. The ensemble shows that identical parameters can generate different epidemic histories. The distribution and summary table quantify that variability and support statements about population burden.
Good communication keeps three levels distinct: an event, one trajectory, and a distribution across trajectories.
CTMC section completion
You can now define CTMC event rates, generate exponential waiting times, select and update events, program SIS/SIR/SEIR models, construct a generator, simulate ensembles, estimate probabilities, calculate outbreak outcomes, and communicate results with appropriate plots and tables.