Simulation Exercise: Disease

NOTES: You will need to include copies of your R graphs. Therefore, please complete your responses in a
Microsoft Word document or other word processing format that supports graphics. In addition, you will
be provided with the R code in a separate file.
Overview
This lab focuses on disease which is a special case of predator-prey interaction. The study of infectious
diseases, their spread, and their control is often referred to as epidemiology. The word epidemiology is
derived from the word epidemic, which literally means that which is “on” (epi-) “the people” or “the
country and its people” (demos). The modern definition of the word epidemic was established by the
Greek philosopher and physician Hippocrates in his foundational work, Corpus Hippocraticum, where he
grouped diseases by their symptoms and considered the progression of disease over time (Martin and
Martin-Granel 2006).
Since Hippocrates, we have developed a mathematical framework to describe infectious disease in
terms of virulence, infectivity, and basic reproductive number in the SIR (Susceptible Infected Recovered)
model. In this lab you will use R to explore the SIR model, use it to describe the spread of disease and
to identify how to control the spread of disease.
We will be using a variant of the SIR model where there is no recovery from infection and there is no
birth – there is a fixed number of individuals in the population. Thus, individuals can be either
susceptible, infected, or dead. We will also include some number of vaccinated individuals in the
population, who cannot become infected. Notice that in our simplified model, we are not accounting for
deaths from causes other than infection (i.e., old age, background mortality rate).
Vaccinated
Hosts (Rvac)
Susceptible
Hosts (S)
Infected
Hosts (I)
Death
Initial Population
β
α
15 points
2
Procedure

  1. Given the flow chart (above) and notes from lecture, define the following variables: [1 pt]
    a. Rvac:
    b. �:
    c. �:
    d. R0:
  2. Our model is made up of the equations that describe how each of our four population sub-groups
    changes over time. The total population is given by � = � + � + �)+ + � . The change in each of the groups is given by the following equations: Susceptible �� �� = −�� � � Infected �� �� = �� � � − �� Vaccinated ��)+
    �� = 0
    Dead ��
    �� = ��
    We can convert these equations to code using the following block, which creates a function for
    changing each of the population groups over time. Run this block once, and then this function will be
    ready to use for the rest of the assignment.

Function which sets up our model

SIRfunc = function(t, x, parameters){
# x contains each of our population groups at time t:
S = x[1] # the value of S at time t
I = x[2] # the value of I at time t
Rvac = x[3] # the value of Rvac at time t
D = x[4] # the number of deaths at time t

# Calculate each of the changes in subgroup population,
# then return them as a list.
with(as.list(parameters),{
N = S + I + Rvac + D # the population size
dS = -betaSI/N # the derivative of S wrt time
dI = +betaSI/N - alphaI # the derivative of I wrt time 15 points 3 dRvac = 0 # change in vaccinated population dD = alphaI
out = c(dS, dI, dRvac, dD)
list(out)
})
}

  1. Given the code below, what are the initial values of the following variables. [1.5 pts]
    (Hint: If the value is given by an equation below, please calculate the actual value!)
    a. Rvac:
    b. �:
    c. �:
    d. R0:
    e. Susceptible (S):
    f. Infected (I):
    NOTE: You may need to change some of these variables later in the assignment. If you change a
    value, make sure to re-run the whole block of code again to ensure the changes were implemented.

Initial Parameters

t = seq(0, 250, 1) # Time (x-axis)
alpha = 1/10
R0 = 3
beta = R0*alpha

Starting Values

N = 10000000
I_0 = 1
Rvac_0 = 0
S_0 = N - I_0 - Rvac_0
D_0 = 0

  1. Run the following code and insert the graph you produce, as well as and the final percentage of the
    population in each of the following categories (Susceptible, Infected, Vaccinated, and Dead). [2 pts]
    a. Insert Graph Here
    15 points
    4
    b. Susceptible:
    c. Infected:
    d. Vaccinated:
    e. Dead:
    NOTE: In previous assignments, we’ve used a difference equation with very small time-steps to plot
    our populations through time. Here, we’ll use a package called ‘deSolve’, which is used to find
    solutions to differential equations. Specifically, we’ll be using the function lsoda() to calculate values
    for the model at each time step.

Load the required packages

Only need to do this step once!

install.packages("deSolve")
require("deSolve")
library(ggplot2)
library(reshape2)

New Graph? Run Code From Here Down

parameters = c(alpha = alpha, beta = beta)
initial = c(S = S_0, I = I_0, Rvac = Rvac_0, D = D_0)
model.out = as.data.frame(lsoda(initial, t, SIRfunc, parameters))

Plot the Results as Fraction of Population

plot(model.out$time,(model.out$S/N)100,type="l", xlab="Time",ylab="Percent N",ylim=c(0,100),lwd=2,col="blue") lines(model.out$time,(model.out$I/N)100,type="l",col="red",lwd=2)
lines(model.out$time,(model.out$Rvac/N)100,type="l",col="green",lwd=2) lines(model.out$time,(model.out$D/N)100,type="l",col="black",lwd=2)
legend("topright",
legend=c("Susceptible","Infected","Dead","Vaccinated"),
bty="n",lwd=3,col=c("blue","red","black","green"),cex=0.7)

Results in Words

cat("Final Susceptible (%): ",round(min(model.out$S)/N100,2),"\n") cat("Final Infected (%): ",round(min(model.out$I)/N100,2),"\n")
cat("Final Dead (%): ",round(max(model.out$D)/N100, 2),"\n") cat("Max. Infected (%): ",round(max(model.out$I)/N100,2),"\n")
cat("Max. Vaccinated (%): ",round(max(model.out$Rvac)/N*100,2),"\n")

  1. That is what happens if no one is vaccinated. Let’s see if we can improve survival by vaccinating some
    portion of the population. [2 pts]
    15 points
    5
    a. We know that R0 is related to disease spread, so let’s start there. Write the equation for R0 in
    terms of alpha (α) and beta (β). [1 pt]
    b. If the goal is to stop the spread of this disease, then we must find the value of v (the proportion
    of the population that is/should be vaccinated) given the values for α, and β in our model. What
    value of v will stop the spread of this disease? Please show your work. [1 pt]
    (Hint: to stop the spread of the disease, we need to decrease R0 to some critical value)
  2. Update your initial parameters to include vaccination. Add a new parameter to the model (v)
    representing vaccinated individuals, assigning the variable with the value you calculated in step 5b.
    Change the starting value of Rvac_0 from 0 to v*N, and run the model again. [2 pts]
    a. Insert your new plot here. [1 pt]
    b. What percentage of the population did you vaccinate? [0.33 pt]
    c. What percentage of the population was dead at the end of the simulation? [0.33 pt]
    d. What percentage of the population was still susceptible at the end of the simulation? [0.33 pt]
  3. What happens if you can’t vaccinate the proportion of the population that is required to stop the
    spread of disease? Pick a value for Rvac_0 that is greater than 0 but less than the value you used in
    question 5, and rerun the model. [3 pts]
    a. Insert your new plot here. [1 pt]
    b. How is the portion of the population grouped as Susceptible, Infected, and Dead different in this
    case versus a completely vaccinated population? [1 pt]
    c. Comparing the results from steps 4 and 6 with your results here, what conclusions can you
    draw? [1 pt]
  4. This model includes a few simplifications from the full SIR model. Other than background mortality
    rate, what is an element of the full model we considered in lecture that is missing from this one? How
    would you change the equations to include it? [2 pts]
  5. This system assumes a population that mixes homogenously, such that every individual is equally
    likely to contact every other individual and disease is spread through these contacts. Describe why
    this might be a shortcoming to the model in 1-2 sentences. [1.5 pts]

46

Type of paper: Sources needed
Other ( ) 2 Double spaced Writing from scratch Essay No specific sources required
Subject Mathematics Topic Writing Assignment: Modeling Lab Report 2
Academic Level : Bachelor
 
status:
Junior Level
balance:
$51.24
rating:
4.73
11/9/2020 Order 330543553
https://admin.writerbay.com/orders_available?subcom=detailed&id=330543553 2/3
Paper details
Objectives:
Apply what you know about solving trig equations and trig derivatives to analyze a sinusoidal model for the
hours of daylight in International Falls, MN and a model for the motion of an object at the end of a spring.
Deepen your understanding by interpreting your results in practical terms.
Instructions:
Work through the problems in the lab report.
Make sure to upload your work as a single pdf.
You are encouraged to work on the problems in groups, but each of you should write your own report. If you do
work with others, please include the names of the students you worked with.
Grading Criteria:
Quality of graphs: accurate, neat, well-labeled
Computation: complete, correct
Interpretations: complete, correct, well-explained in easy-to-understand practical terms