Models and Methods in Health Data Science

Lecture 4: Extending the SIR model

Rachel Oughton

15/02/2023

1 Overview

So far we have explored the relatively simple closed SIR model.

However, real world infectious diseases are often much more complex.

Today we will look at some examples of extending the SIR model to have more realistic features:

1.1 Adding an \(E\) compartment

Let’s now investigate the impact of adding a pre-infectious (or exposed) \(E\) compartment, to create an SEIR model.

The trajectory in an SEIR model.

The trajectory in an SEIR model.

Need to rethink the differential equation slightly:

1.1.1 Rate of change in susceptibles (\(S\))

When people leave the \(S\) compartment,

So the equation for \(S\) remains the same:

\[\frac{dS}{dt} = -\frac{\beta I S}{N}.\]

1.1.2 Rate of change in pre-infectious (\(E\))

The people leaving \(S\) above are joining \(E\), but still being infected by those in \(I\)

As people’s latent period comes to an end, they move to the \(I\) compartment.

Therefore we have:

\[\frac{dE}{dt} = \frac{\beta I S}{N} - \sigma E.\]

1.1.3 Rate of change in infectious (\(I\))

People are now joining the \(I\) compartment from \(E\) with rate \(\sigma\),

Therefore:

\[\frac{dI}{dt} = \sigma E - \gamma I. \]

Rate of change in recovered/removed (\(R\)) is unchanged

SEIR model equations

Our system of equations for an SEIR model is therefore:

\[\begin{align*} \frac{dS}{dt} &= \color{green}{b N}- \color{purple}{m S} -\frac{\beta I S}{N}\\ \frac{dE}{dt} &= \frac{\beta I S}{N} - \sigma E - \color{purple}{m E} \\ \frac{dI}{dt} &= \sigma E - \gamma I - \color{purple}{m I}\\ \frac{dR}{dt} &= \gamma I - \color{purple}{m R} \end{align*}\].

2 Population dynamics - the open epidemic

In this section:

Population dynamics - the open epidemic

One simple change is to include vital dynamics - birth and death rates.

This is especially important over long time periods (years)

Vital dynamics equations

Our SEIR equations now become

\[\begin{align*} \frac{dS}{dt} &= \color{green}{b N}- \color{purple}{m S} -\frac{\beta I S}{N}\\ \frac{dE}{dt} &= \frac{\beta I S}{N} - \sigma E - \color{purple}{m E} \\ \frac{dI}{dt} &= \sigma E - \gamma I - \color{purple}{m I}\\ \frac{dR}{dt} &= \gamma I - \color{purple}{m R} \end{align*}\]

Where \(b\) and \(m\) are the birth and mortality rates, and \(0<{b,m}<1\)

Note that \(m\) represents the general underlying mortality rate, not mortality specifically related to this epidemic.

A stable population

It is common practice to assume a stable population by setting \(m=b\)

Note: In an open epidemic it is more common to work with proportions of people in compartments, rather than total numbers.

2.1 Example: the open epidemic

Let’s start with parameter values \[ \begin{align*} \beta &= \frac{2}{7} \\ \sigma & = \frac{1}{2} \\ \gamma & = \frac{1}{14} \end{align*} \] and initial values (now thinking in proportions) \[ \begin{align*} S & = 0.999\\ E & = 0 \\ I& = 0.001\\ R & = 0 \end{align*} \]

SEIR with vital dynamics - code

library(deSolve)
sir_vital = function (t, y, params)
{
  # label state variables from within the y vector
  S = y[1]        # susceptibles
  E = y[2]        # Exposed
  I = y[3]        # infectious
  R = y[4]        # recovered
  N = S + E + I + R
  # Pull parameter values from the params vector
  beta = params["beta"]
  gamma = params["gamma"]
  sigma = params["sigma"]
  m = params["m"]
  b=params["b"]
  
  # Define equations, now with m and b terms
  dS = b*N -m*S-(beta*S*I)/N
  dE = beta*S*I/N - sigma*E - m*E
  dI = sigma*E - gamma*I -m*I
  dR = gamma * I - m*R

  # return list of gradients   
  res = c(dS, dE, dI, dR)
  list(res)
}

Example: the first 9 months (no vital dynamics)

The first nine months of this model without population dynamics (ie. with \(b=m=0\)).

Example: the first 9 months (with vital dynamics)

The same system with \(m=b = \frac{1}{7*365}\). This is for exaggeration purposes - it assumes an average life expectancy of 7 years.

Example: vital dynamics extended

The same SIR model plotted for five years. \(S\) gradually increases, a threshold is reached and there is another small peak (around day 1500).

Often used to model diseases such as Measles (pre-vaccine) where there can be a low level of the disease present in the population, with occasional outbreaks.

Example: vital dynamics extended even longer

The \(I\) compartment for a measles-like disease plotted for 70 years.

Here, \(\beta = \frac{13}{7},\,\sigma=\frac{1}{8},\,\gamma = \frac{1}{7}\) and \(m = b = \frac{1}{365\times 70}\)

3 Waning immunity

In this section:

Waning immunity

So far we have focussed on infectious diseases that lead to full immunity following infection.

In the SIR model, once people are in the \(R\) (Removed) compartment, they stay there forever.

In fact, with many infectious diseases:

This is an SEIRS model.

Waning immunity: equations

We use the parameter \(w\) to denote the rate at which immunity is lost, and our equations become

\[ \begin{align*} \frac{dS}{dt} &= \color{blue}{wR} -\frac{\beta I S}{N}\\ \frac{dE}{dt} &= \frac{\beta I S}{N} - \sigma E \\ \frac{dI}{dt} &= \sigma E - \gamma I \\ \frac{dR}{dt} &= \gamma I - \color{blue}{wR} \end{align*} \]

The average time for which someone retains their immunity will therefore be \(\frac{1}{w}\) (in terms of the model’s time units).

Waning immunity: R code

library(deSolve)
sir_wane = function (t, y, params)
{
  # label state variables from within the y vector
  S = y[1]        # susceptibles
  E = y[2]        # Exposed
  I = y[3]        # infectious
  R = y[4]        # recovered
  N = S + E + I + R
  # Pull parameter values from the params vector, including new 'w' parameter
  beta = params["beta"]
  gamma = params["gamma"]
  sigma = params["sigma"]
  w = params["w"]

  # Define equations, now with w terms
  dS = w*R - (beta*S*I)/N
  dE = beta*S*I/N - sigma*E 
  dI = sigma*E - gamma*I 
  dR = gamma * I - w*R

  # return list of gradients   
  res = c(dS, dE, dI, dR)
  list(res)
}

3.1 Example: waning immunity

We will use the same parameter values as in our first open epidemic example:

\[ \begin{align*} \beta &= \frac{2}{7} \\ \sigma & = \frac{1}{2} \\ \gamma & = \frac{1}{14} \end{align*} \] and initial values (now in terms of proportions) \[ \begin{align*} S & = 0.999\\ E & = 0 \\ I& = 0.001\\ R & = 0 \end{align*} \]

Example: Waning immunity

If we set \(w=0\) then people don’t leave the \(R\) compartment and immunity doesn’t wane:

Example: Waning immunity

Now we set \(w=0.01\) (so that people retain immunity for an average of 100 days).

Example: Waning immunity - long term

Plotting over 5 years, we see that an equilibrium is reached

Unlike the models we have seen so far, people cycle through the compartments.

4 Example: respiratory syncytial virus (RSV)

In this section we will study a real example that includes:

Example: respiratory syncytial virus (RSV)

From White et al. (2007).

Human respiratory syncytial virus (RSV):

The point of this example is to show you a real compartmental infectious disease model, and some of its features - don’t worry about retaining the detail!

Example: RSV model

In this model, there are four compartments:

The birth and mortality rates are assumed equal (\(\mu\)) so that \[ S + I_S + I_R + R = N.\]

Example: RSV diagram

  • People begin in compartment \(S\).
  • At rate \(\Lambda\left(t\right)\) they are infected, and join \(I_S\).
  • Their infection is lost at rate \(\tau\).
    • Proportion \(\frac{\alpha}{\rho}\) return to \(S\), while proportion \(1-\frac{\alpha}{\rho}\) join \(R\) (so we need \(0\leq{\alpha}\leq{\rho}\)).
  • From \(R\) the rate of reinfection is damped by the ‘partial susceptibility factor’ \(\sigma\) (\(0\leq{\sigma}\leq{1}\)).
  • When people in \(R\) are reinfected, they join compartment \(I_R\)
  • The rate of people leaving \(I_R\) (to either \(R\) or \(S\)) is \(\frac{\tau}{\rho}\), where \(0<\rho\leq{1}\) represents a reduced duration of infectiousness.
  • People move from \(R\) to \(S\) at rate \(\frac{\alpha\tau}{\rho}\) (waning partial immunity).

Example: RSV equations

There is a term for every transfer in the model:

\[\begin{align*} \frac{dS}{dt} & = \mu N-\frac{\Lambda\left(t\right) S}{N} + \frac{\alpha \tau}{\rho}\left(I_S + I_R + R\right) - \mu S\\ \frac{dI_S}{dt} & = \frac{\Lambda\left(t\right) S}{N} - \left(\tau + \mu\right) I_S \\ \frac{dI_R}{dt} & = \frac{\sigma\Lambda\left(t\right) R}{N} - \left(\frac{\tau}{\rho} + \mu\right)I_R\\ \frac{dR}{dt} & = \left(1-\frac{\alpha}{\rho}\right)\tau I_S + \left(1-\alpha\right)\frac{\tau}{\rho}I_R - R\left(\frac{\sigma\Lambda\left(t\right)}{N}+\frac{\alpha\tau}{\rho}+\mu\right). \end{align*}\]

Notice that infection involves a function \(\Lambda\left(t\right)\)

Example: RSV varying transmissibility

The function \(\Lambda\left(t\right)\) (which governs infectiousness) is given by

\[\begin{equation} \Lambda\left(t\right) = Q\left(t\right)\times{}\left(I_S + \eta I_R\right)\times{\left(\tau+\mu\right)}. \end{equation}\]

In White et al. (2007), \(Q\left(t\right)\) is used to represent seasonal variation (more on that later).

For now we set \(Q\left(t\right)=\frac{b}{\tau+\mu}\), so that

\[ \Lambda\left(t\right) = b\left(I_S + \eta I_R\right). \] Here,

Example: running the RSV model

To run this model, we need

We set initial proportions to:

\[\begin{align*} S & = 0.999\\ I_S& = 0.001\\ I_R& = 0,\\ R & = 0. \end{align*}\]

and parameter values to:

\[\begin{align*} \mu& = \frac{1}{365\times{70}}\\ \alpha& = 0.16\\ \tau& = \frac{1}{6} \end{align*}\]

\[\begin{align*} \rho & = 0.8\\ \sigma & = 0.3\\ b & = 0.5\\ \eta & = 0.8 \end{align*}\]

Example: RSV model outputs

This system reaches an equilibrium by around day 60.

Note that people are still moving between compartments, but that the proportions in each remain steady.

4.1 Introducing seasonality

Seasonal variability is an important component of many infectious disease models, and so we will now include it.

White et al. (2007) specify \[ Q\left(t\right) = \frac{b\left(a\cos\left[2\pi\left(t-\phi\right)\right]+1\right)}{\tau+\mu}. \]

Here

Example: Plotting Q

Exercise

Remember that the seasonality function \(Q\left(t\right)\) is involved in the model via the transmission function \(\Lambda\left(t\right)\),

In groups, discuss what you expect to see as we include seasonality in the model. How do you think it will differ from the version with no seasonality?

Example: RSV model output

After the initial outbreak, the system settles into a cycle.

For this plot, we set a=0.5, phi=0.

5 Summary

In this lecture we have looked at some developments to SIR-type models that enable them to model more complex behaviour.

6 References

White, LJ, JN Mandl, MGM Gomes, AT Bodley-Tickell, PA Cane, P Perez-Brena, JC Aguilar, et al. 2007. “Understanding the Transmission Dynamics of Respiratory Syncytial Virus Using Multiple Time Series and Nested Models.” Mathematical Biosciences 209 (1): 222–39.