# Table of Contents
# Com
EpiJS module for representing communities
Import it with:
const com = require('@epispot/epijs').com
# Virus
Class representing a virus, which can infect a community.
# Parameters
rnaughtNumber (opens new window) The disease's R-NaughtuNumber (opens new window) The disease's recovery rateaNumber (opens new window) The disease's incubation period (optional, default0)dNumber (opens new window) The disease's death rate (for infected population) (optional, default0)
# Examples
let covid = new Virus(5.7, 2.1/100)
# Community
Class representing a community, which can be infected with a disease, and compared to other communities.
# Parameters
popNumber (opens new window) The population of the communityiNumber (opens new window) The start infected population of the community.sNumber (opens new window) The start susceptible population of the community
# Examples
let NewYorkCity = new Community(8419000, 300, 8418700)
# sir
SIR model for the community
# Parameters
diseaseNumber (opens new window) A virus class. The virus to infect the community with and model for.timeNumber (opens new window) Time to predict for.stochasticBoolean (opens new window) Whether to make the model stochastic or not.
# Examples
let NewYorkCity = new Community(8419000, 300, 8418700)
let covid = new Virus(5.7, 2.1/100, 1/8, 1/100)
outbreak = NewYorkCity.sir(covid, 100, false)
# seir
SEIR model for the community
# Parameters
diseaseNumber (opens new window) A virus class. The virus to infect the community with and model for.timeNumber (opens new window) Time to predict for.stochasticBoolean (opens new window) Whether to make the model stochastic or not.
# Examples
let NewYorkCity = new Community(8419000, 300, 8418700)
let covid = new Virus(5.7, 2.1/100, 1/8, 1/100)
outbreak = NewYorkCity.seir(covid, 100, false)
# seird
SEIRD model for the community
# Parameters
diseaseNumber (opens new window) A virus class. The virus to infect the community with and model for.timeNumber (opens new window) Time to predict for.stochasticBoolean (opens new window) Whether to make the model stochastic or not.
# Examples
let NewYorkCity = new Community(8419000, 300, 8418700)
let covid = new Virus(5.7, 2.1/100, 1/8, 1/100)
outbreak = NewYorkCity.seird(covid, 100, false)
# custom
Custom model for the community
# Parameters
compartmentsArray (opens new window) The compartments for the model. Pass in as an array with sub arrays of the form [compartment, name in key]. Note that the 'name in key' is a string with the same value that is stored in your extra key, otherwise it should be the same name that we store it as. You can find these names below.- Susceptible - stored as 'S'
- Infected - stored as 'I'
- Recovered - stored as 'R'
Make sure that you use the same names that are stored in the key in the equations for the compartments. These values are found from parameters passed into the virus class and the community class.
timeNumber (opens new window) The time to predict for.virusThe virus class to infect the community with.extrakeyObject (opens new window) Optional, any extra parameters for the compartments equations. We already have the following parameters:- Population - stored as 'p' in our key.
- Susceptible Population - stored as 'S' in our key.
- R-naught - stored as 'rn' in our key.
- Recovery rate - stored as 'u' in our key.
- Recovered - stored as 'R' in our key.
- Infected - stored as 'I' in our key.
- Death Rate - stored as 'd' in our key.
- Incubation Period - stored as 'a' in our key.
# Examples
let susceptible = new Idiom("S-(B*S*I/p)");
let infected = new Idiom("I+(B*S*I/p)-(u*I)");
let recovered = new Idiom("R+(u*I)");
let NewYorkCity = new Community(8419000, 300, 8418700)
let covid = new Virus(5.7, 2.1/100, 1/8, 1/100)
outbreak = NewYorkCity.custom([[susceptible, 'S'], [infected, 'I'], [recovered, 'R']], 100, covid, {B: covid.rnaught*covid.u})
# compare
Compare's two different outbreaks, communities, or anything else.
# Parameters
cHTMLCanvasElement (opens new window) The canvas elementmodel1Function (opens new window) The first model to compare.model2Function (opens new window) The second model to compare.m1nameString (opens new window) The name of the first modelm2nameString (opens new window) The name of the second modeldaysNumber (opens new window) The total amount of days to compare for.
# Examples
let NewYorkCity = new Community(8419000, 300, 8418700)
let covid = new Virus(5.7, 2.1/100)
let covid_variant = new Virus(5, 4/100)
let chart = document.getElementById('model')
covid_outbreak = NewYorkCity.sir(covid, 100)
variant_outbreak = NewYorkCity.sir(covid_variant, 100)
compare(chart, covid_outbreak, variant_outbreak, "COVID-19", "COVID-19 Variant", 100) // We chose 100 as the amount of days, but it could be 50 or 25, not the lenght of the prediction that was in the model.