Skip to content

EpiModel/EpiModel-Gallery

Repository files navigation

EpiModel Gallery

Test Gallery Models

A curated collection of tutorials for extending the EpiModel platform to model infectious disease dynamics over networks. Each example demonstrates how to build custom modules for stochastic network models using exponential random graph models (ERGMs), with fully annotated walkthroughs on the Gallery website.

EpiModel provides built-in SIS/SIR models out of the box, but its module API supports arbitrarily complex epidemic systems. The learning curve for writing custom modules can be steep, so these examples teach by example -- from adding a single compartment to multi-stage disease models with interventions and cost-effectiveness analysis. The examples are organized from beginner-friendly fundamentals through intermediate extensions to full applied disease models.

Gallery Examples

Fundamentals

Example Description
SEIR/SEIRS: Adding an Exposed State Adding an exposed (latent) compartment to SIR, with optional waning immunity
SI with Vital Dynamics SI with aging, births, deaths, and age-specific mortality

Interventions

Example Description
SEIR with AON Vaccination SEIR with all-or-nothing vaccination, vital dynamics, and herd immunity
SEIRS with Leaky Vaccination SEIRS with leaky vaccination (reduced transmission probability) and vital dynamics
Test and Treat SIS with screening and antibiotic treatment for bacterial STIs

Intermediate Extensions

Example Description
Competing Strains SIS with two pathogen strains differing in infectiousness and duration
Social Diffusion SI framework repurposed for social diffusion with threshold and dose-response contagion

Network Features

Example Description
Observed Network Data Epidemics over observed (census) dynamic networks without ERGM estimation
Multilayer Networks Multilayer networks with cross-layer dependency (e.g., main vs. casual partnerships)

Full Disease Models

Example Description
HIV HIV with acute/chronic/AIDS stages and antiretroviral therapy (ART)
Syphilis Multi-stage syphilis with diagnosis, treatment, and recovery

Advanced Extensions

Example Description
Cost-Effectiveness Analysis SI with cost-effectiveness analysis: costs, QALYs, discounting, and ICERs

Each example contains model.R (network estimation and simulation), module-fx.R (custom module functions), and index.qmd (annotated tutorial on the website).

Getting Started

The recommended way to learn is through the Gallery website, which presents each example as an annotated tutorial with model diagrams, code walkthroughs, and output plots. Start with the Fundamentals section and work through the examples in order.

To run the code yourself:

Prerequisites

  • R >= 4.5
  • EpiModel >= 2.6.0

Install EpiModel from CRAN:

install.packages("EpiModel")

Running an Example

Clone the repository, then run any example from the project root:

source("examples/si-vital-dynamics/model.R")

Or from the command line:

Rscript examples/si-vital-dynamics/model.R

Running All Examples

bash test.sh

This runs each example's model.R and reports pass/fail with timing.

Contributing

Contributions of new gallery examples are welcome! To contribute:

  1. Fork this repository on GitHub.
  2. Create a new subdirectory under examples/ named descriptively (e.g., sir-vaccination/) containing:
    • model.R -- main script for network estimation and simulation
    • module-fx.R -- custom module functions plugged into control.net()
    • index.qmd -- annotated Quarto tutorial (see existing examples for the format)
    • thumbnail.png -- thumbnail image for the gallery listing
  3. Include the standard unit test lines near the top of model.R (see existing examples).
  4. Verify your example passes: bash test.sh
  5. Verify the website builds: quarto render
  6. Submit a Pull Request.

Citation

If using EpiModel for teaching or research, please include a citation:

Jenness SM, Goodreau SM and Morris M. EpiModel: An R Package for Mathematical Modeling of Infectious Disease over Networks. Journal of Statistical Software. 2018; 84(8): 1-47. doi: 10.18637/jss.v084.i08

License

MIT

About

Gallery of Network-Based Epidemic Model Templates for EpiModel

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors