# Evolutionary Dynamics

## Overview

For this module, we will explore a stochastic SIR-type model with 2 different pathogen strains, wild-type and a drug resistant mutant in the presence of drug treatment. Read about the model in the “Model” tab. Then do the tasks described in the “What to do” tab.

### Learning Objectives

- Understand the central mechanisms and drivers of infectious disease evolution
- Be able to assess how different control strategies can affect infectious disease evolution

## The Model

### Model Overview

This model tracks susceptibles, wild-type infected untreated, wild-type infected treated, drug-resistant infected and recovered hosts. The following compartments are included:

- S - uninfected and susceptible individuals
- Iu - individuals who are infected with the wild-type/drug sensitive strain and not on treatment.
- It - individuals who are infected with the wild-type/drug sensitive strain and on treatment.
- Ir - individuals who are infected with the drug-resistant strain. Treatment has no impact on those hosts, so is not modeled.
- R - recovered/removed individuals. Those individuals have recovered and are immune.

The included processes/mechanisms are the following:

- Susceptible individuals, S can become infected by untreated or treated hosts infected with the wild-type strain at rates bu and bt.
- A fraction f of those hosts infected with the wild-type strain are assumed to receive treatment (It), while the remainder does not (Iu).
- Each time a wild-type infected host transmits to a susceptible host, there is a probability of a resistant mutant being transmitted; consequently, this generates a resistant infection. These probabilities are represented by cu and ct for wild-type untreated and treated hosts, respectively.
- Individuals infected with the resistant strain, Ir, might receive treatment, but we assume treatment has no effect in those individuals so don’t track them explicitly.
- Resistant infected individuals can infect susceptible individuals (S) with the resistant strain at rate br.
- All infected hosts recover at some rate gi, with i=u,t,r.
- Recovered individuals are immune to reinfection.

### Model Implementation

The flow diagram for the model implemented in this app is:

Model Diagram

The deterministic/ODE equations for this model are:

\[\dot S = - S (b_u I_u + b_t I_t + b_r I_r)\] \[\dot I_u = S (1-f) b_u (1-c_u) I_u + S (1-f)b_t (1-c_t) I_t - g_u I_u\] \[\dot I_t = S f b_u (1-c_u) I_u + S f b_t (1-c_t) I_t - g_t I_t\] \[\dot I_r = S (b_u c_u I_u + b_t c_t I_t + b_r I_r) - g_r I_r\] \[\dot R = g_u I_u + g_t I_t + g_r I_r\]

However, for this app we do not implement a deterministic/ODE model. Instead, we implement its stochastic equivalent. We can specify the model by writing down every possible transition/event/reaction that can occur and their propensities (the propensity multiplied with the time step gives the probability that a given event/transition occurs). For our model these are the following:

Event type | Transitions | Propensity
--- | --- | ---
S turn into Iu | S => S-1, Iu => Iu+1 | (1-f) * (bu * (1-cu) * Iu + bt * (1-ct) * It) * S
S turn into It | S => S-1, It => It+1 | f * (bu * (1-cu) * Iu + bt * (1-ct) * It) * S
S turn into Ir | S => S-1, Ir => Ir+1 | (bu * cu * Iu + bt * ct * It + br * Ir) * S
Recovery of Iu | Iu => Iu-1, R => R+1 | gu * Iu
Recovery of It | It => It-1, R => R+1 | gt * It
Recovery of Ir | Ir => Ir-1, R => R+1 | gr * Ir

## 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 (e.g. if it says a week, you need to convert it to 7 days).

### Task 1

Set the model parameters to the following: susceptible S = 500, and initially untreated infected host Iu = 1. No other infected hosts, no recovered. Set simulation duration to 300 days, start at day 0, time step doesn’t matter. Assume that untreated individuals transmit at bu = 0.001, treated at bt = 0.0005, and resistant at br = 0.0008. Assume that the duration of the infectious period is 5 days for untreated, 4 days for treated and 5 days for resistant (for those individuals, treatment has no effect). Set the rates gi accordingly. Assume nobody receives treatment and no resistance is generated (f = cu = ct = 0). Set the number of simulations to 20, random seed 123. With parameters set to correspond to the scenario just described, run the simulation. You should see 12 of the simulations with outbreaks and the others without. Only untreated infected will differ from zero. Make sure you understand why. For those simulations with outbreaks, you should have around 50-85 susceptible left at the end.

Record

- Average number of susceptible at end of simulation

### Task 2

Now we’ll explore treatment. Set initial untreated infected to 10 (to ensure we get outbreaks). Consecutively set the fraction receiving treatment, f, to 0, 0.25, 0.5, 0.75 and 1. For each treatment level, run 20 simulations (be patient) and record the average value of recovered at the end. Based on that, compute the reduction in total total number of infected as treatment level increases.

Record

- Number of averted infections going from f=0.25 to f=0.75

- Number of averted infections going from f=0 to f=0.5

- Number of averted infections going from f=0.5 to f=1

### Task 3

Now allow resistance to be generated during treatment (ct > 0). Set ct = 0.2 for the fraction of resistant generation from treatment. Run the simulation for the treatment levels specified in the previous task, again determine total number infected for each treatment level. On a piece of paper, sketch out the relationship between treatment level and the total number infected in the absence and presence of resistance generation (ct = 0, recorded in previous task, and ct > 0, recorded here). What do you conclude from that?

Record

- Number of averted infections going from f=0.25 to f=0.75

- Number of averted infections going from f=0 to f=0.5

- Number of averted infections going from f=0.5 to f=1

### Task 4

Set the rate of transmission for resistant hosts to br = 0.001, also increase resistance generation during treatment to ct = 0.3. Keep everything else as previously. Contemplate what these changes mean biologically, and what you should expect from the simulations. Run the model for each of the 5 treatment levels specified above and record the total number infected at each treatment level. Draw them in the same figure you started above. What do you conclude from that?

Record

- Number of averted infections going from f=0.25 to f=0.75

- Number of averted infections going from f=0 to f=0.5

- Number of averted infections going from f=0.5 to f=1

### Task 5

In the previous task, you should have found that as you increase treatment, the total number of infected initially goes down, but then goes up again. Let’s try to find the optimal treatment level. Explore different values of f in steps of 0.05 to find the value that gives the lowest total number of infected (of course you don’t have to start at f=0, you can explore the space around the area where you know the optimal value is.

Record

- The treatment level f for which you get the lowest number of total infections

### Task 6

The general idea explored here is that if you have a situation where resistance might emerge, it reduces the effectiveness of a treatment and might mean that sometimes more treatment is not better. The details depend on the fitness of the different infection compartments (in our model represented by the parameters bi and gi) and the speed at which resistance can emerge either without or with treatment, which in our model is governed by the parameters cu and ct. Explore how different values for those parameters impact the usefulness of treatment. As you change parameter values, try to connect them to biology, i.e. try to understand what it would mean in the real world if certain parameters had certain values.

Record

- Nothing

## 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(s) running the simulation are called `simulate_Drug_Resistance_Evolution_stochastic`. 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.
- The model is a simpler version of a previously published model in (Handel, Longini, and Antia 2009).

### References

Handel, Andreas, Ira M Longini, and Rustom Antia. 2009. “Antiviral Resistance and the Control of Pandemic Influenza: The Roles of Stochasticity, Evolution and Model Details.” J Theor Biol 256 (1): 117–25. https://doi.org/http://dx.doi.org/10.1016/j.jtbi.2008.09.021.