The author has declared that no competing interests exist.

This is a

Modern infectious disease epidemiology makes heavy use of computational model–based approaches and a dynamical systems perspective. The importance of analyzing infectious diseases in such a way keeps increasing. However, infectious disease epidemiology is still often taught mainly from a medical and classical epidemiological study design (e.g., cohort, case-control) perspective.

While textbooks and other resources that teach a model-based approach to infectious diseases exist, almost any such teaching material requires students to work with mathematical models and write computer code. This is a significant barrier for students who do not have a strong mathematical background or prior coding experience, which applies to many students in public health and related biomedical disciplines. It limits the number of students who can or want to engage with infectious disease epidemiology by using modern, systems modeling–based approaches. New tools and approaches are needed to reach a wider audience and allow students to learn concepts such as the reproductive number, herd immunity, critical community size, and the population-level impact of interventions from a dynamical systems and model perspective, without the obstacles of coding or having to formulate and analyze differential equations.

Here, I describe a new software package for the widely used

Epidemiology has its roots in the study of infectious diseases. While modern epidemiology deals with a host of different health-related topics, infectious diseases are still an important component. The classical study approach of epidemiology, based on randomized controlled trials, cohort studies, case-control studies, and related study designs, can be successfully applied to infectious diseases.

However, this framework of study generally does not account for a crucial aspect of infectious diseases, namely, the nonindependence between individuals. Accounting for interactions between hosts is required to understand important infectious disease concepts such as population-level immunity thresholds, critical community size, or indirect effects of interventions.

On the research side, the importance of such interactions has long been appreciated and is at the core of the infectious disease modeling paradigm, in which one builds and analyzes a system of interacting components (e.g., susceptible and infected hosts). Such systems approaches based on models have a long history in infectious disease epidemiology [

While resources (e.g., textbooks [

Good examples of ways to teach modern infectious disease epidemiology concepts without requiring students to have computational or mathematical skills are some recent online courses, most notably the course “Epidemics—the Dynamics of Infectious Diseases” [

The audience for the DSAIDE package are individuals interested in understanding infectious disease spread and control on the population level from a dynamical systems and modeling perspective. The package was originally built to complement a course on infectious disease epidemiology from a dynamical systems perspective. However, the documentation contained within DSAIDE strives to be detailed and self-contained enough to allow a motivated student to use DSAIDE and learn the topics covered by the package on their own. Any knowledge gaps can be filled by reading the provided references. For more advanced students who are comfortable with some level of coding, the package can be used as described in “Level 2” and “Level 3” below, either on its own or as a complement to a course on infectious disease modeling.

The package currently consists of 12 simulations (hereafter referred to as “apps”) that allow for the exploration of different topics in infectious disease epidemiology.

App_Name | Model | Topic_Covered |
---|---|---|

ID Dynamics Intro | 3-compartment (SIR) ODE model. | A first introduction to a simple compartmental SIR model. Allows simulation of a single outbreak for different parameter and initial condition settings. |

Characteristics of ID | 6-compartment ODE model. | The potential role of different disease states (e.g., presymptomatic, asymptomatic, symptomatic) on ID dynamics. |

ID Patterns | 6-compartment ODE model. Includes natural births and deaths, waning immunity, and seasonality in transmission. | Different ID patterns (single outbreak, oscillations, steady states). |

Direct Transmission | 3-compartment ODE model. Births, deaths, and waning immunity are included. | The differences between density-dependent and frequency-dependent transmission and their impact on ID dynamics. |

Environmental Transmission | 4-compartment ODE model. Includes explicit environmental stage. Natural births and deaths are included. | The impact of environmental shedding, decay, and transmission. |

Vector Transmission | 5-compartment ODE model. Includes susceptible and infected vectors and their dynamics. Births and deaths for vectors and waning immunity for hosts are included. | Exploration of a simple vector-borne transmission model. |

Reproductive Number | 3-compartment ODE model. Includes vaccination of population at the beginning of the simulation. Births, deaths, and waning immunity are included. | The reproductive number concept and how to estimate it from (simulated) data. |

ID Control | 9-compartment ODE model. An environmental and 2 vector stages as well as 6 host stages. | The impact of different control measures for different types of ID. |

Host Heterogeneity | 6-compartment ODE model. 2x SIR for 2 different hosts. | The impact of host heterogeneity and core groups on ID dynamics and control. |

Stochastic Dynamics | 4-compartment (SEIR) stochastic model. Births, deaths, and waning immunity are included. | Stochasticity of ID dynamics, the phenomenon of ID extinction. |

Evolutionary Dynamics | 5-compartment stochastic model. Untreated and treated hosts infected with wild-type, and hosts infected with a resistant strain. | Interaction between drug treatment and evolution/emergence of drug resistance. |

Multi-Pathogen Dynamics | 9-compartment ODE model with basic SIR dynamics for 2 pathogens and coinfection. | Infection dynamics for 2 pathogens. |

Abbreviations: DSAIDE, Dynamical Systems Approaches to Infectious Disease Epidemiology; ID, infectious disease; ODE, Ordinary Differential Equation; SEIR, Susceptible-Exposed-Infected-Removed; SIR, Susceptible-Infected-Recovered.

The package is installed like any other

Install R from

Optional, recommended: install RStudio from

Open R/Rstudio, install the package by typing

Load the package with

Call the main menu by typing

You are ready to explore!

Note: The package is developed and hosted publicly on Github at

The following sections describe the main ways for students to interact with the DSAIDE package. The idea is that everyone starts at level 1, and then, depending on needs and interests, they can decide whether to move on to the next level.

The interactive exploration of the models and infectious disease concepts through the graphical user interface is the main intended use of this package. Once the package is loaded, the main menu is started by executing the command

DSAIDE, Dynamical Systems Approaches to Infectious Disease Epidemiology.

The user interacts with each app through a graphical interface consisting of input boxes to set model parameters and other settings and output in the form of graphs and text.

Inputs are on the left; outputs in the form of graphs and useful numbers (e.g., maximum of each compartment during the simulation) are provided on the right. Below this is the documentation for the app; an example is shown in the next figure. S, Susceptible; I, Infected; R, Recovered.

Below the input and output areas are several tabs that contain detailed information for each app. The main tabs are the “Model” and the “What to do” tabs. The former describes the model, including showing the flow diagram and equations for the model. The latter contains a list of suggested tasks to learn about the topic covered by the app.

ODE, Ordinary Differential Equation; SIR, Susceptible-Infected-Recovered.

After exploring an app, the user returns to the main menu and eventually exits the main menu and closes the R session. No code needs to be written. The user can fully focus on learning the infectious disease topics and concepts covered by the different apps.

The interaction with DSAIDE described in the previous section is the main intended use of the package. However, it is easy for a student to gently proceed from having no interaction with the code to writing a few lines of additional code. To facilitate direct interaction with the code, the simulation model underlying each app is a stand-alone function. This simulator function can be called directly, without going through the graphical interface. The “Further Information” tab of each app provides the name of the corresponding simulator function and a brief description of how to interact with it.

For instance, for the first app, “ID Dynamics Intro,” the underlying simulator function is called

Calling the simulation function runs the underlying dynamical model, here a simple 3-compartment Susceptible-Infected-Recovered (SIR) model implemented via ordinary differential equations and described in the “Model” section of the app. The simulation function produces and returns time series for the dynamics of each of the variables that are tracked. Users can produce their own plots, e.g., plotting susceptible, infected, and recovered individuals as a function of time with the code provided below.

Calling the simulation functions directly allows additional exploration of the models. For instance, if one wanted to systematically explore the behavior of a model for different values of some model parameter, one would need to do this manually if run through the graphical interface. By calling the function directly, this can be automated. As an example, the following lines of

This plot is obtained by wrapping the

By using this “Level 2” approach, the user can wrap their own code around the existing simulator functions and easily explore questions and scenarios that would be impossible or tedious to explore through the graphical interface. This provides a lot more flexibility. It requires writing some, but rather minimal,

In addition to interacting with the simulation functions, the user can directly access and modify them. To make this easy, copies of all simulator functions are in a sub-directory called “simulatorfunctions” inside the DSAIDE package folder. The exact location of this folder depends on the settings for the

Each simulator function is well documented. Some basic to intermediate level of R coding experience is required to successfully modify the functions. A simple example follows. Assume that one wants to modify the SIR model encoded in

old:

new:

old:

new:

old:

new:

No other parts of the simulator function code need to be modified. It is now possible to explore how different rates of waning immunity impact the outbreak peak by slightly modifying the code shown above in “Level 2,” namely, by writing a loop that goes through different values for the waning immunity parameter,

The result of this simulation is shown in

This approach of using the DSAIDE package allows the user to completely customize the existing code based on their own needs and interests. Once a student makes it to this level, they are on their way to becoming a modeler who builds and analyzes their own models.

It is quite likely that there are still bugs and typos in the package and its documentation; if you find some, let me know. DSAIDE is hosted on Github at

For individuals interested in tools and resources related to infectious disease epidemiology, a number of additional R packages exist. The following are packages I am currently aware of.

For learning and teaching, the EpiModel package [

The EpiDynamics [

For research purposes, the R Epidemics Consortium (RECON) [

A very powerful set of functions for fitting compartmental models to data is provided by the POMP R package [

I described the

The following individuals contributed bits of code or bug-fixes to this package: Spencer Hall, Brian McKay, John Rossow, Sina Solaimanpour. I thank the reviewers for feedback that helped to improve this manuscript and the DSAIDE package.