Networks and Epidemics

A guide to using EpiModel for epidemic modeling


Sam Jenness

Steve Goodreau

Martina Morris


February 1, 2024


This ebook contains all the material needed to teach yourself how to use the EpiModel package for epidemic modeling. The book begins with an overview of the foundations of epidemic modeling – from deterministic compartmental modeling to stochastic network models – works through how to implement all of these models using EpiModel’s built-in functions, and provides an introduction to using EpiModel’s extension API to build more complex research-level models for your own work.

While EpiModel is capable of implementing deterministic compartmental models and “agent-based” or “individual-based” models, this ebook focuses primarily on the EpiModel’s unique ability to implement stochastic network models. These models are based on a principled statistical framework known as “Exponential-family Random Graph Models” (ERGMs) that allow researchers to represent everything from simple random graphs (aka “Erdos-Reyni” or “Bernoulli random graphs”) to very complex networks.

  • Where did this ebook come from?

The materials in this book were originally developed to teach a weeklong intensive workshop on epidemic modeling called Network Modeling for Epidemics. We refined the materials as we taught the course over about a decade, initially in-person on the University of Washington campus, and then with the Covid pandemic, online. An interdisciplinary team of instructors developed the materials and taught the course, including an Epidemiologist, an Anthropologist and a Statistician/Sociologist. Over the years the lectures and labs were updated and modified with the input from our research assistants, postdocs, students and users, so this final product owes much to their patience, enthusiasm and insight.

  • Who is this ebook intended for?

These materials are intentionally designed to be accessible to a wide range of users – you definitely don’t need to be a mathematical modeler or statistician to learn from them! Those trained in traditional epidemic modeling can also learn things here, in particular, how to model epidemics on stochastic networks using principled, data-driven statistical methods. Our goal in this ebook is to make these tools available to applied researchers and practitioners from many backgrounds: from public health departments and veterinary science, to social science, epidemiology and mathematics. Our students have come from all of these fields over the years, and from around the world, including the global south. Some participants take the course to provide a foundation for their own epidemic modeling projects, others take it so that they can understand and critique the research on epidemic modeling that they are reading.

If your goal is to use EpiModel for your own research projects, you will need to know (or learn) how to program in the R computing environment. We have provided some suggestions for getting started with R if you don’t already have this background. The lectures and labs provide a thorough introduction to using EpiModel in R, with many code examples.

A brief overview of EpiModel and its capabilities can be found in this article

  • How to use this ebook?

Each chapter contains a mixture of “lecture” type materials and labs for practicing the concepts with exercises and solutions. The first couple chapters are designed to make sure all of the foundations are in place, so depending on your background, some of the material there may be review.

Chapter 1: “Epidemic and Networks 101”

If you’re a newbie to epidemic modeling, we recommend going through this chapter carefully, working though each of the labs to get the basic principles down. All of the foundation you need for the rest of the course is provided here.

If you have prior experience with epidemic modeling, you can probably skim (not skip) this chapter, to make sure you’re familiar with each of the basic modeling frameworks and their benefits and drawbacks. The labs in this chapter will also give you a feel for simple EpiModel coding and functionality.

Chapter 2: “Statistical models for networks”

Everyone should work through this chapter (if you’re already familiar with ERGMs, you can skim). It provides, using simple intuitive examples, an introduction to the key concepts that make network analysis different from the usual empirical research frameworks taught in most disciplines. It shows why these concepts matter for epidemics, what kind of network data would be needed to explore these effects, how these data can be modeled using flexible statistical methods, and how the fitted models can in turn be used to simulate epidemics on dynamic networks that “look like” the data you have.

Chapters 3 thru 5:

The remaining chapters get into the details of using EpiModel to model epidemics on networks. Chapters 3 and 4 introduce EpiModel’s built-in models for representing epidemics with and without feedback processes. Chapter 5 provides instructions on using the EpiModel API to move beyond these built-in models and build models for your own research-level projects.

  • Acknowledgements.

    EpiModel has been developed with the generous support of the U.S. National Institutes of Health. The publication of this ebook was supported by the NIH grant R01 AI138783.

  • Prerequisites

A basic working knowlege of the R computing environment is needed in order to install and use the EpiModel software.

  • This ebook is based on R version 4.3.2 (2023-10-31) and EpiModel package version 2.3.2

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.