Templates 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).
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.
| Example | Description |
|---|---|
| AddingAnExposedState | SEIR/SEIRS: adding an exposed (latent) compartment, with optional waning immunity |
| ObservedNetworkData | Epidemics over observed (census) dynamic networks without ERGM estimation |
| SIwithVitalDynamics | SI with aging, births, deaths, and age-specific mortality |
| TestAndTreatIntervention | SIS with screening and antibiotic treatment for bacterial STIs |
| CompetingStrains | SIS with two pathogen strains differing in infectiousness and duration |
| SocialDiffusion | SI framework repurposed for social diffusion with threshold and dose-response contagion |
| SEIRwithAONVax | SEIR with all-or-nothing vaccination, vital dynamics, and herd immunity |
| Syphilis | Multi-stage syphilis with diagnosis, treatment, and recovery |
| SEIRSwithLeakyVax | SEIRS with leaky vaccination (reduced transmission probability) and vital dynamics |
| HIV | HIV with acute/chronic/AIDS stages and antiretroviral therapy (ART) |
| CostEffectivenessAnalysis | SI with cost-effectiveness analysis: costs, QALYs, discounting, and ICERs |
| Multinets | Multilayer networks with cross-layer dependency (e.g., main vs. casual partnerships) |
Each example contains three files: README.md (model explanation), model.R (network estimation and simulation), and module-fx.R (custom module functions).
- R >= 4.5
- EpiModel >= 2.6.0
Install EpiModel from CRAN:
install.packages("EpiModel")Clone the repository, then run any example from the project root:
source("2018-08-AddingAnExposedState/model.R")Or from the command line:
Rscript 2018-08-AddingAnExposedState/model.Rbash test.shThis runs each example's model.R and reports pass/fail with timing.
You may use and extend any of these examples in any way you want. We ask that if you publish a paper using EpiModel (with or without these gallery examples), you include a citation (see below).
Contributions of new gallery examples are welcome! To contribute:
- Fork this repository on GitHub.
- Create a new subdirectory named
YYYY-MM-Description/containing three files:README.md-- explanation of the model, authors, and detailsmodel.R-- main script for network estimation and simulationmodule-fx.R-- custom module functions plugged intocontrol.net()
- Include the standard unit test lines near the top of
model.R(see existing examples). - Verify your example passes:
bash test.sh - Submit a Pull Request. We will review, request changes if needed, and merge.
If you'd like to ask "how would you build a network model in EpiModel that does X?", file a GitHub Issue with a detailed description. We may generalize specific requests so the example is broadly useful.
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