# Reproductive Number 1 - Practice

## Overview

This app is meant to teach you about the basic concepts behind the reproductive number. Read about the model in the “Model” tab. Then do the tasks described in the “What to do” tab.

### Learning Objectives

- Understand the concept of the reproductive number
- Be able to compute the reproductive number for simple models
- Be able to determine the reproductive number using final outbreak size information
- Be able to determine the reproductive number using initial infected numbers

## The Model

### Model Overview

For this app, we’ll use the basic compartmental SIR model. This model has the following compartments: We allow for 3 different stages/compartments:

- S - uninfected and susceptible individuals
- I - infected and infectious individuals (note that these terms are often used interchangeably, but technically we are talking about someone who is infected and is infectious, i.e. can infect others)
- R - recovered/removed individuals. Those are individuals that do not further participate, either because they are now immune or because they died.

In addition to specifying the compartments of a model, we need to specify the dynamics determining the changes for each compartment. Broadly speaking, some processes increase the number of individuals in a given compartment/stage and other processes that lead to a reduction. Those processes are sometimes called inflows and outflows.

For our system, we specify the following processes/flows:

- Susceptible individuals (S) can become infected by infectious individuals (I) at some rate, b. This leads to the susceptible individual leaving the S compartment and entering the I compartment.
- Infected individuals recover and enter the recovered (R) compartment at some rate, g.

### Model Implementation

The flow diagram and the set of equations which are used are the basic SIR model and are shown again:

Model Diagram

The model equations are:

\[\dot S = - b SI \] \[\dot I = b S I - g I \] \[\dot R = g I\]

### Reproductive number

The app and tasks deal with the reproductive number concept. The following section provides a very brief introduction. I recommend reading a bit more about it. I’m following the terminology of my own write-up. You can also check the books listed in the ID introduction app or some of the papers listed in the Further Resources section of this app.

The reproductive number is defined as the average number of new infected (and infectious) individuals caused by one infectious individual. The basic reproductive number is the reproductive number in a scenario where everyone is susceptible. For the SIR model shown above, one can figure the value out by determining how many new infections are caused by one infected person. A person is infectious for a duration of 1/g, during that time they infect others at rate b. Thus the average number of new infections during created in b/g. For the whole population, assuming initially everyone is susceptible, we multiply by the number of initial susceptibles to get \[R_0=\frac{bS_0}{g}\] where S0 is the initial number of susceptibles.

For a single outbreak (no births, natural death or waning immunity) and a basic SIR model, an equation linking the final number of susceptibles left at the end and the basic reproductive number is \[R_0=\frac{\ln(S_f)}{(S_f - 1)}\] where \(\ln()\) is the natural logarithm and Sf is the fraction of susceptibles still left, i.e. \(S_f = S_{final}/S_{initial}\), where \(S_{initial}\) and \(S_{final}\) are the number of susceptibles at the beginning and end of the outbreak.

Note the unfortunate fact that the letter R is used both for the recovered compartment in the model and the reproductive number. This is standard notation and I’ll therefore use it here. Just be careful to figure out from the context if someone is talking about the recovered individuals or the reproductive number.

## What to do

The tasks below are described in a way that assumes everything is in units of days (rate parameters, therefore, have units of inverse days). If any quantity is not given in those units, you need to convert it first.

### Task 1

Set the simulation the following simulation parameter values 1000 susceptibles, 1 infected, tfinal = 100 days, g=0.5, and b=0.001. Run the simulation, you should get an outbreak. Use the final size equation linking R0 and the fraction of susceptible hosts left at the end of the outbreak to compute the reproductive number (see the information in the Model tab).

Record

- Day at which outbreak peaks

- Susceptible at end of simulation

- The value for R0

### Task 2

Use the equation that expresses R0 as a function of the model parameters. Using the values of the model parameters from task 1, compute R0. Check that it agrees with what you found in the previous task.

Record

- The value for R0

### Task 3

Double the value of the transmission parameter, b. Leave everything else as before. Before you run the simulation, use the equation to compute R0. Then run the simulation and compute R0 using the final outbreak size. Make sure the two numbers approximately agree.

Record

- The value for R0

### Task 4

Double the rate of the recovery parameter, g. Leave everything else unchanged. Think about your expectations for R0 and the resulting outbreak dynamics. Run the simulation to check your expectations. Use the final outbreak size to compute R0.

Record

- Day at which outbreak peaks

- Susceptible at end of simulation

- The value for R0

### Task 5

Another way to estimate R0 is to determine the rate of increase in infected hosts at the beginning of the outbreak. During the initial phase, new infections increase exponentially according to I(t)=I0 exp(rt), with r being the rate of growth. Usually, for any real outbreak, you do not know the number of infected at the start, I0, or the exact time the outbreak starts. It is still possible to estimate r by obtaining two values of I at two time points during that initial growth rate, i.e. I1 at time t1 and I2 at time t2. One obtains equations I1=I0 exp(r t1) and I2=I0 exp(r t2). By solving one of these equations for I0 and substituting into the other, we get I2= I1 exp(r (t2 - t1)). By solving the model for r and entering numbers for I1 and I2 and times t1 and t2 we can figure out r. Let’s try that out. Set the model parameters back to those given in task #1. Let’s try using the new method for estimating R0. Run the model with tfinal = 1 and tfinal = 2 and record the number of infected at the end of the simulation each time. Then substitute all the values into the equation you found for r and thus compute the growth rate. For this model, the growth rate and R0 are related through R0 = 1+rD, where D is the average duration of the infectious period (i.e. the inverse of the recovery rate). Use this to determine R0. You should get essentially the same answer (up to some rounding differences) as for task #1. Note that the choice of t1 and t2 can influence the results. Earlier times are better since once the number of susceptibles starts to drop markedly, the growth of infected slows down and is not exponential anymore.

Record

- The value for R0

### Task 6

What is the value of the reproductive number R at the time the outbreak peaks? (It’s only called R0 at the beginning for a fully susceptible population). Explain how you can find that value for R, both using intuitive reasoning and using the equation for R0 given above (R0 = 1+rD). For some hints, note that at the peak numbers of infected are briefly flat, i.e. there is no more growth (what does that mean for r?). Also, there is no decline yet, for the infected to stay exactly the same, the average number of infections produced by one infected person before they recover needs to have a very specific value. What is that value? Note that at this R value, the outbreak wanes, but people still get infected. What R value would you need to halt any further infections completely?

Record

- R value at which number of infected neither grows nor declines

- R value to completely halt any further infections

### Task 7

What would happen if a new ID came along that had an R0 value that was the same as the one you just determined in the previous question, namely the value of R at the peak of an outbreak? Test this with the simulation. Set everyting as in task 1, then reduce transmission rate by half, which should get you the right R0 (you can check by plugging the parameter values into the R0 equation). Run the simulation and observe what the model produces. You should not see any outbreak.

Record

- Nothing

### Task 8

1. R0 quantifies the level of transmissibility of an ID, which determines how many people will become infected or what level of intervention is needed to stop/prevent an outbreak. However, it is important to be aware that R0 says nothing about the timing/dynamics of the outbreak. Set parameter values as in #1. Also increase simulation time to 200 so we can make sure the outbreak is over. Run an outbreak, pay attention to the time of peak and duration of the outbreak (the latter is somewhat ill-defined, so just come up with a rough number).
2. Now increase the infectious duration by a factor of 4 (rate reduced by a factor of 4) and adjust the infectiousness-level such that you get the same R0 as before. Run again and compare the results concerning total outbreak size and timing of outbreak.

Record

- Number susceptible left at end of outbreak (part A)

- Day the outbreak peaked (part A)

- Number susceptible left at end of outbreak (part B)

- Day the outbreak peaked (part B)

## Further Information

- This app (and all others) are structured such that the Shiny part (the graphical interface you see and the server-side function that goes with it) calls an underlying R script (or several) which runs the simulation for the model of interest and returns the results.
- For this app, the underlying function running the simulation is called `simulate_SIR_model_ode`. You can call them directly, without going through the shiny app. Use the `help()` command for more information on how to use the functions directly. If you go that route, you need to use the results returned from this function and produce useful output (such as a plot) yourself.
- You can also download all simulator functions and modify them for your own purposes. Of course to modify these functions, you’ll need to do some coding.
- For examples on using the simulators directly and how to modify them, read the package vignette by typing `vignette('DSAIDE')` into the R console.
- For the equations mentioned in the tasks, see e.g. (Heffernan, Smith, and Wahl 2005; Keeling and Rohani 2007; Vynnycky and White 2010).
- For some information on the reproductive number, see e.g. (Fine, Eames, and Heymann 2011; Heffernan, Smith, and Wahl 2005; Roberts 2007; Wallinga and Lipsitch 2007).

### References

Fine, Paul, Ken Eames, and David L Heymann. 2011. “"Herd Immunity": A Rough Guide.” Clinical Infectious Diseases : An Official Publication of the Infectious Diseases Society of America 52 (7): 911–16. https://doi.org/10.1093/cid/cir007.
Heffernan, J M, R J Smith, and L M Wahl. 2005. “Perspectives on the Basic Reproductive Ratio.” Journal of the Royal Society, Interface / the Royal Society 2 (4): 281–93. https://doi.org/10.1098/rsif.2005.0042.
Keeling, Matt, and Pejman Rohani. 2007. Modeling Infectious Diseases in Humans and Animals. Princeton University Press.
Roberts, M. G. 2007. “The Pluses and Minuses of R0.” Journal of The Royal Society Interface 4 (16): 949–61. https://doi.org/10.1098/rsif.2007.1031.
Vynnycky, Emilia, and Richard White. 2010. An Introduction to Infectious Disease Modelling. Oxford University Press.
Wallinga, J, and M Lipsitch. 2007. “How Generation Intervals Shape the Relationship Between Growth Rates and Reproductive Numbers.” Proceedings. Biological Sciences / The Royal Society 274 (1609): 599–604. https://www.ncbi.nlm.nih.gov/pubmed/17476782.