Function Repository Resource:

EpidemicModel

Source Notebook

Generate an interactive tool for visualizing various compartment-based epidemiological models

Contributed by: Wolfram|Alpha Math Team

ResourceFunction["EpidemicModel"][]

returns an interactive model of various compartment-based epidemiological models.

ResourceFunction["EpidemicModel"][model]

returns the specified model.

Details and Options

A common method for studying epidemics is to use compartment-based models. In such models, the population is divided among different compartments that are relevant to study (e.g. "Susceptible", "Infected", "Recovered", etc.). The flow of people among these compartments over time as the disease spreads is modeled using differential equations, which are then solved by NDSolve for this function. This function assumes an all-to-all contact model for the population, meaning that all people are equally likely to come into contact with one another.
The input model may be any of "SI" (susceptible-infected), "SIS" (susceptible-infected-susceptible), "SIR" (susceptible-infected-recovered), "SEIR" (susceptible-exposed-infected-recovered), "SVIR" (susceptible-vaccinated-infected-recovered), "SIQR" (susceptible-infected-quarantined-recovered) or "SPIR" (susceptible-powerinfected-infected-recovered). For descriptions of the compartments used in each model, see citations.
The option "InputFields" defaults to None but when set to All, uses InputField for parameters instead of using sliders.

Examples

Basic Examples (1) 

Display an interactive model:

In[1]:=
ResourceFunction[
 "EpidemicModel", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][]
Out[1]=

Scope (2) 

Specify which model to display:

In[2]:=
ResourceFunction[
 "EpidemicModel", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["SVIR"]
Out[2]=

Click the Data button to output a snapshot of the model for the given time and parameter settings:

In[3]:=
ResourceFunction[
 "EpidemicModel", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["SPIR"]
Out[3]=

Options (1) 

Use "InputFields"All to display all parameters as input fields:

In[4]:=
ResourceFunction[
 "EpidemicModel", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["SVIR", "InputFields" -> All]
Out[4]=

Publisher

Wolfram|Alpha Math Team

Version History

  • 2.0.0 – 23 March 2023
  • 1.0.0 – 09 June 2020

Source Metadata

Related Resources

Author Notes

To access source code:

In[1]:=
FileNameJoin[
      Append[
   Most[FileNameSplit[FindFile["ResourceFunctionHelpers`"]]], "EpidemicModel.wl"]] // SystemOpen

License Information