3. The SIR model is used by epidemiologists to calculate the theoretical number
ID: 3790362 • Letter: 3
Question
3. The SIR model is used by epidemiologists to calculate the theoretical number of Susceptible, Infected and Recovered individuals in a host population during a pandemic. It can be expressed by the following differential equations due to Kermack and McKendrick in 1927: ds BIS dt (1) dR (2) dt dS (3) dt dt dt where S, I, R represent proportions of individuals in a population of size N, B is the rate at which an infected person infects a susceptible person, and is the rate at which people recover from the disease. An assumption of this model is that after recovery from the disease the host cannot become susceptible again. Assume that 0.1, B 0.6 and that the initial number of infected individuals is ten from a population size of five million. You must ONLY use the R programming language for this question. You cannot use any R simulation or differential equation solver libraries. (a) (6 points) In lecture we discussed the forward Euler method for approximating the solution to the above system. However, an improvement to that algorithm (given below) typically yields a better result. Specifically, the calculation is yi +Atf(ti, yi) (4) At (5)Explanation / Answer
For writing the SIR:
sir <- function(time, state, parameters) {
with(as.list(c(state, parameters)), {
dS <- -beta * S * I
dI <- beta * S * I - gamma * I
dR <- gamma * I
return(list(c(dS, dI, dR)))
For plotting the graph use "matplot" function
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.