8  Branching process

Branching process is also called the Galton-Watson Process, because some of the early theoretical results about the process derive from a correspondence between Sir Francis Galton and the Reverend Henry William Watson in 1873. It is used to model reproduction.

Consider a population of reproducing individuals.

A branching process is defined as follows:

\[\{Z_0, Z_1, Z_2, Z_3, \dots\} = \{Z_n : n \in \mathbb{N}\}\]

Now if we replace reproduction with infection.

\[\{Z_0, Z_1, Z_2, Z_3, \dots\} = \{Z_n : n \in \mathbb{N}\}\]

8.1 Simulate an outbreak with branching process

  • Initialise index cases: Start with \(n\) index cases at time \(t = 0\) (or at explicitly sampled onset times).

  • Draw offspring distribution: For each case \(i\), draw the number of secondary infections, \(Z_i\). The dominant choice in modern outbreak work is the negative binomial distribution, \(Z_i \sim \text{NB}(R, k)\), where \(R\) is the reproduction number and \(k\) is the dispersion parameter capturing superspreading.

  • Assign timelines: For each offspring, draw a generation interval or serial interval from a Gamma or Log-normal distribution. Add an incubation period to calculate the onset date, and a reporting delay to get the notification date.

  • Iterate and terminate: Repeat this process generation by generation until the transmission chain goes extinct, or until a predefined stopping rule is triggered (e.g., maximum cases, maximum generations, or a calendar cut-off)

  • Compile the line list: Record each new case as a single row in the output data frame containing id, infector_id, generation, t_infection, t_onset, and t_report

8.1.1 Interactive simulation

The simulation always starts with one index case at \(t=0\). Tune the offspring distribution \(Z\sim\text{NB}(R,\ k)\) and the gamma generation interval in their own boxes. Each press of Step alternates between two clearly separated draws for the case currently ringed in dashed teal:

  1. Sample \(Y\) from \(\text{NB}(R, k)\) — the tree immediately spawns \(Y\) dashed offspring placeholders at the parent’s time;
  2. Sample \(Y\) generation intervals at once — one dot per child lands on the gamma curve, every placeholder slides to its true \(t_\text{infection}\), and one row per child appears in the line list.

When the current parent is done, the simulation moves to the next individual. Hover or tap any case in the tree to highlight the matching row in the line list (and vice versa). At the bottom, type a calendar date for case 1 and click Generate dates to convert every numeric t_infection into a real date_infection — that is all it takes to turn a branching-process simulation into a fully-formed outbreak line list.

TipReading the simulation
  • Box 1 — Offspring distribution — the bar chart is the \(\text{NB}(R, k)\) pmf, sampled exactly as \(\lambda \sim \text{Gamma}(k, R/k)\), \(Y \mid \lambda \sim \text{Poisson}(\lambda)\) so \(\mathbb E[Y]=R\) and \(\text{Var}[Y]=R+R^2/k\). Each “sample \(Y\)” step highlights the bar at the drawn value.
  • Box 2 — Generation interval — the gamma curve is parameterised by mean and sd. On the single “sample GI” step that follows, one dot per offspring lands on the curve at the same time so you can see the whole batch of intervals being drawn together.
  • Branching tree — every press of Step alternates between two beats for the case ringed in dashed teal: first beat samples \(Y\) and spawns \(Y\) dashed placeholder offspring at the parent’s time; the very next beat samples all \(Y\) generation intervals at once, slides every placeholder to its true \(t_\text{infection}\), and appends one row per child to the line list. The next parent is then picked in BFS order.
  • Tree ↔︎ Line list linkage — hover or tap any case in either view; the matching node and row light up in amber. Tap again to clear the selection.
  • Date generation — type a real-world calendar date for case 1 and click Generate dates: the date_infection column instantly fills in for every case as start_date + t_infection days. Any cases generated afterwards inherit the same conversion automatically — that’s how a numeric simulation becomes a real line list.