SIR Epidemic Model

1D Ordinary Differential Equations

The SIR model is a classical compartmental model in epidemiology. It splits the population into:

and describes how individuals move between these compartments over time.

We will use the normalized SIR model (fractions of the population, so \(S+I+R=1\)):

\[ \begin{aligned} \dot S &= -\beta SI,\\ \dot I &= \beta SI - \gamma I,\\ \dot R &= \gamma I. \end{aligned} \]

Reference Implementation

A working implementation is provided in:

  • sessions/s01_odes_1d/sir_model.py

The model function is sir_model(t, y, beta, gamma) and the plotting helper is plot_sir_model(...).

Render-time Figure

The figure below is generated at render-time from the reference script.

Figure 1: SIR dynamics for default parameters.

Exploration

  1. Increase \(\beta\) while keeping \(\gamma\) fixed. What happens to the peak of \(I(t)\)?
  2. Increase \(\gamma\) while keeping \(\beta\) fixed. Does the epidemic end sooner?
  3. Try different initial infected fractions \(I(0)\). Do you always see an outbreak?

Run Locally

To run the standalone script and show the plot:

python sessions/s01_odes_1d/sir_model.py