Federica Gazzelloni
April 22, 2023
All materials we need:
GitHub Repo: https://github.com/Fgazzelloni/sir-model-with-R/
In this presentation, we will explore how to implement the deterministic SIR model in R, including how to simulate the model, plot the results, and interpret the output.
We will also discuss the assumptions and limitations of the model and how to extend it to more complex scenarios.
So, let’s dive in and learn more about the deterministic SIR model in R!
The SIR model is a mathematical model used to describe the spread of infectious diseases in a population.
The model divides the population into three compartments:
The deterministic version of the SIR model assumes that the transmission rate and recovery rate are constant over time and that the population is homogeneous.
\(N\) is the population
, \(S\) the susceptible
, \(I\) the infected
, \(R\) the recovered.
\(\beta\) and \(\gamma\) are the parameters, the transmission rate
and the recovery rate
respectively, expressed in \(day^-1\).
\[\frac{dS}{dt}=-\beta S \frac{I}{N}\] \[\frac{dI}{dt}= \beta S \frac{I}{N} -\gamma I\] \[\frac{dR}{dt}= \gamma I\]
Define the parameters
Set the initial values and parameters
Define the SIR model
Simulate the model
Here are some sources to look at for improving your knowledge about how to make a deterministic SIR model in R:
The R Epidemics Consortium (RECON)
is a group of researchers and practitioners who develop and apply computational models to understand and control infectious disease outbreaks. They have a GitHub repository with R code for simulating and analyzing SIR models.
The {EpiModel}
package is an R package for simulating and analyzing stochastic and deterministic epidemic models, including the SIR model. The package includes functions for parameter estimation, sensitivity analysis, and visualization.
The {deSolve}
package is an R package for solving differential equations, which are commonly used to model dynamic systems such as the SIR model. The package includes functions for solving ordinary differential equations (ODEs) and partial differential equations (PDEs).
The Epidemic Modeling with R (EMR)
book provides a comprehensive introduction to epidemic modeling with R, including the SIR model. It covers both deterministic and stochastic models, as well as parameter estimation, sensitivity analysis, and model validation.
For example, the SIR (Susceptible-Infected-Recovered) model is a deterministic model that describes the dynamics of the spread of a virus, but it also includes stochastic elements such as random interactions between individuals.
Quarto Presentation