Deterministic models

John M. Drake

Introduction to compartmental models

Steps in developing a model

  1. Formulate objectives
  2. Conceptual diagram
  3. Dynamic equations
  4. Computer code

Example: Influenza outbreak in a British boarding school

Objective: A running example to illustrate compartmental modeling

plot of chunk unnamed-chunk-1

Example: Influenza outbreak in a British boarding school

Note the idealizations

  1. There are differences between what is observable (clinical status) and what is relevant to transmission (infection status)
  2. Compartments discretize what may in reality be a continuum

The SIR model: State variables

A classic model for an acute immunizing infection that classified individuals according to infection status

  • Susceptible
  • Infections
  • Recovered/Immune

These quantities will be our state variables

First studied extensively by Kermack & McKendrick (1927) A Contribution to the Mathematical Theory of Epidemics. Proceedings of the Royal Society of London. Series A 115 (772): 700–721

The SIR model: Compartmental model structure

Determined by pathology/immunology

Compartmental models can represent a wide range of transmission systems and population structures

Transmission systems

  • Sexual transmission
  • Environmental transmission
  • Vector-borne transmission

Structure

  • Age
  • Sex
  • Location

Compartmental models can represent a wide range of transmission systems and population structures


Model kinetics

The kinetics of the model are determined by flows between the compartments which are mathematically represented by rates of change

Flows depend on characteristics of the host population and the pathogen biology and include things like contact rates among hosts, and pathogen infectivity. These variables are our model parameters.

Writing down the model: Variables

Assign each state variable a unique variable (typically a Roman letter)

  • Susceptible: (\( S \) for proportion, \( X \) for number)
  • Infectious: (\( I \) for proportion, \( Y \) for number)
  • Recovered: (\( R \) for proportion, \( Z \) for number)

Assign parameters a unique variable (typically a Greek letter)

  • Contact rate: \( \kappa \)
  • Pathogen infectivity: \( \nu \)
  • Transmissibility (contact rate times infectivity): \( \beta = \kappa \times \nu \)
  • Recovery rate: \( \gamma \)

Note: Notation varies among authors; one should not assume that a symbol used in two different papers means the same in each.

Writing down the model: Flows

Sum the positive and negative flows that affect each state variable

\[ \begin{aligned} \frac{dX}{dt} &= - \beta XY \\ \frac{dY}{dt} &= \beta XY - \gamma Y \\ \frac{dZ}{dt} &= \gamma Y \end{aligned} \]

Note: These equations can also be derived using difference quotients and the fundamental theorem of calculus. I find it more straightforward to think in terms of flows.

Note: Sometimes “overdot notation” is used to signifiy time derivatives, i.e. \( \dot{X} = \frac{dX}{dt} \).

The force of infection

It is common to think of the rate at which susceptibles become infected as caused by a force acting on each susceptible individually.

This force of infection, which we might denote by \( \lambda \), may be identifed by factoring the \( X \) out of our equation for \( \frac{dX}{dt} \), i.e.

\[ \begin{aligned} \frac{dX}{dt} &= - \beta XY \\ &= - (\beta Y) \times X \\ &= - \lambda \times X \\ \end{aligned} \]

Density-dependent and frequency-dependent transmission

The force of infection may take many different forms depending on the conditions under which transmission occurs. A common distinction is between density dependent transmission (\( \lambda = \beta Y \)) and frequency dependent transmission (\( \lambda = \beta \frac{Y}{N} \), where \( N = X+Y+Z \) is the total population size).

If the population size does not change (i.e. \( N \) is a constant) then these two models differ only by the units of \( \beta \). However, if the population size does change (for instance due to disease-induced mortality) then these two forces of infection result in very different dynamical outcomes.

Density dependent transmission

  • Above, we assumed that the contact rate was constant (i.e. “mixing” is independent of population size). This is frequency-dependent transmission.
  • For some pathogens, contact will be proportional to population size (i.e. increasing with “crowding”), in which case the force of infection is \( \lambda = \beta Y \) giving transmission rate \( \beta XY \). This is called density-dependent transmission.


plot of chunk unnamed-chunk-2

Density-dependent and frequency-dependent transmission


Epidemic trajectories differ according to parameters


plot of chunk unnamed-chunk-4


plot of chunk unnamed-chunk-5

Generalization

  • Can we make general statements about epidemics without resorting to extensive numerical integration?
  • Under what conditions will an infectious disease invade a system

The invasion threshold

Assume an infectious individual arises in a Wholly Susceptible and otherwise Disease Free population with frequency-dependent transmission

Initial conditions: \( X(0)=N-1 \approx N \), \( Y(0)=1 \), and \( Z(0)=0 \)

Invasion occurs only if \( dY/dt > 0 \)

\[ \begin{align} \frac{dY}{dt} = \beta X Y/N - \gamma Y &> 0 \\ Y(\beta X/N - \gamma) &>0 \\ X/N &> \gamma/\beta \end{align} \]

Since \( X \approx N \), this is satisfied when \( 1>\gamma / \beta \), which is equivalent to \( \beta/\gamma > 1 \)

Kermack & McKendrick (1927)

Basic reproduction number

  • For the \( SIR \) model, the ratio \( \beta/\gamma \) gives the number of secondary cases that will be infected before the index case recovers
  • This quantity is universally referred to as \( R_0 \) and called the Basic Reproduction Number or Basic Reproductive Ratio
  • We can extend the concept of \( R_0 \) to other models with the following definition
  • The basic reproduction number is the number of secondary cases generated a single typical infected case in an entirely suspectible population
  • Hence, \( R_0 \) depends on both properties of the pathogen and properties of the population into which it is introduced

Basic reproduction number vs model parameters

plot of chunk unnamed-chunk-6

Estimates of the basic reproduction number

Expected shape of some epidemics


\( \beta \) \( 1/\gamma \) \( R_0 \)
Measles 886/yr 0.019 yr 17
Influenza 180/yr 0.011 yr 2
Chicken pox 315/yr 0.022 yr 7
Rubella 200/yr 0.025 yr 5


plot of chunk unnamed-chunk-9

Density dependent transmission

  • As before, pathogen invasion occurs if \( dY/dt > 0 \)
  • Assuming nearly everyone initially susceptible \( X \approx N \), then \( \beta NY - \gamma Y > 0 \implies Y(\beta N- \gamma) > 0 \)
  • Now, we define \( R_0 = \beta N / \gamma \)
  • Conclusion: For density dependent transmission there is a threshold population density required for invasion

Incorporating virulence

We assume infectious individuals die at rate \( \alpha \)

\[ \frac{dY}{dt} = ... -\gamma Y - \alpha Y \]

Frequency dependent transmission leads to disease induced extinction


plot of chunk unnamed-chunk-11


plot of chunk unnamed-chunk-13

Guidance on the functional form of transmission

  • If the population size doesn't change substantially then frequency- and density-dependent transmission are equivalent (\( \beta_{FD} = N \times \beta_{DD} \))
  • Otherwise
    • Frequency dependent transmission is typically assumed to be more appropriate for large populations with heterogeneous mixing, sexually transmitted diseases, and vector-borne pathogens
    • Density dependent transmission is assumed to represent wildlife and livestock diseases, especially those with smaller population sizes
    • Empirical evidence suggests that many disease systems are intermediate

Solving the SIR model

When we talk about “solving” a model we mean that we want to know what the state of the system will be at a future time given the system equations and some initial conditions, requiring integration of the equations. These are also known as boundary value problems.

Systems of nonlinear differential equations (like the \( SIR \) model) are typically not analytically tractable, although clever mathematicians have found numerous approximations or special cases, like the final size relation.

\[ 1-R(\infty)-e^{-R(\infty)R_0} \]

Solving the SIR model

Thus, we use numerical algorithms such as the 4th order Runge-Kutta algorithm to take advantage of Euler's approximation to obtain an approximate solution by solving a sequence of tractable linear approximations at smaller and smaller step sizes until a specified tolerance is achieved.

In R, numerical integration of ordinary differential equations is readily performed using the package deSolve. Particularly, the function ode is useful since it automatically selects the optimal solving algorithm based on numerical performance.

Modelers must be cautious, however, and alert to seeming anomalous results resulting from numerical instabilities.

Acknowledgements

Presentations and exercises draw significantly from materials developed with Pej Rohani, Ben Bolker, Matt Ferrari, Aaron King, and Dave Smith used during the 2009-2011 Ecology and Evolution of Infectious Diseases workshops and the 2009-2019 Summer Institutes in Statistics and Modeling of Infectious Diseases.

Licensed under the Creative Commons attribution-noncommercial license, http://creativecommons.org/licenses/bync/3.0/. Please share and remix noncommercially, mentioning its origin.