← Continuous-Time Markov Chains

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

Use a step plot for compartment states. A CTMC state jumps at an event and remains constant until the next event. Connecting states with sloping lines falsely suggests that fractional people change continuously between events.
\[X(t)=X(t_k)\quad\text{for }t_k\le t<t_{k+1}.\]

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.

TableRows representTypical columns
Event logEvents in one trajectoryTime, waiting time, event, \(S,I,R\)
Outcome dataIndependent trajectoriesFinal size, duration, peak, peak time
Summary tableOutcome measuresMedian, 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.

Interactive PythonCTMC visual and tabular report

Output

Run the code to see the result.

How to read the four panels

  1. Panel A: event density is high when the total rate is high. The vertical position labels event type; it is not a numerical magnitude.
  2. Panel B: every vertical jump changes \(I\) by exactly one, while horizontal segments show no change between events.
  3. Panel C: variation in peak, timing and extinction is visible, but twenty displayed paths are illustrative rather than a probability estimate.
  4. Panel D: all 300 outcomes contribute. Separate clusters can reveal early fade-outs and major epidemics.

Match the display to the claim

ClaimSuitable evidenceUnsuitable evidence alone
Events occur at irregular timesEvent timeline or one step pathOutcome histogram
Trajectories vary substantiallyMultiple paths plus ensemble summariesOne selected path
Large outbreaks occur with a given frequencyCount/proportion from all independent runsSpaghetti plot
Median final size has a stated valueOutcome table and marked distributionEvent log from one run

Presentation checks

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.