SEIRS solver

This webpage uses the Runge-Kutta-Fehlberg fourth-order method with fifth-order error checking RKF45 to approximate the solution to the SEIRS equations:

dSdt=λN+ωR−μS−βI(1−δ)SNdEdt=βI(1−δ)SN−(μ+σ)EdIdt=σE−(α+γ+μ)IdRdt=γI−(μ+ω)R.\begin{aligned} \frac{dS}{dt} & = \lambda N + \omega R - \mu S - \frac{\beta I (1-\delta)S}{N} \\ \frac{dE}{dt} & = \frac{\beta I (1-\delta) S}{N} - (\mu + \sigma ) E \\ \frac{dI}{dt} & = \sigma E - (\alpha + \gamma +\mu ) I \\ \frac{dR}{dt} & = \gamma I - (\mu + \omega) R. \end{aligned}

Where:

  • SS is the number of susceptible persons.

  • EE is the number of exposed persons, that is those that have been exposed to the disease but have not yet become infectious.

  • II is the number of infectious persons.

  • RR is the number of recovered persons.

  • α\alpha is the infection mortality rate. This does not perfectly align with how we usually use the term "mortality rate" as it is not just the rate of death per case of infection it is also per time. So more rapidly lethal infections would have a higher α\alpha than their slower counterparts.

  • β\beta is a parameter that pertains to the average number of contacts per person per time and the rate of transmission for the disease.

  • γ\gamma is the inverse of the average time a person is infected with the disease. Diseases with faster recovery therefore have larger γ\gamma.

  • δ\delta refers to the efficacy of quarantine effects. δ=0\delta=0 means quarantine measures are completely ineffective. δ=1\delta=1 means they are completely effective.

  • λ\lambda is the birth rate. It is essentially how many new people join the population per time per existing member of the population.

  • μ\mu is the overall population death rate. It is essentially how many people die per population per time.

  • σ\sigma is the latency rate, which is the inverse of the incubation period. Smaller incubation periods therefore lead to larger σ\sigma.

  • ω\omega is the rate of immunity loss in recovered individuals. Like λ\lambda and μ\mu it is per population per time, although the population it applies to is the recovered population.

  • N=S+E+I+RN=S+E+I+R is the total population.

This model is heavily based on Bjørnstad et al. (2020), with some amendments. Specifically, δ\delta has been added to account for quarantine effects and λ\lambda has been accounted for a innate birth rate that may not match the innate death rate of μ\mu. Hence the basic reproduction number R0R_0 (not to be confused with the initial number of recovered individuals) is given by:

R0=β(1−δ)σ(μ+σ)(α+γ+μ).\begin{aligned} R_0 = \dfrac{\beta (1-\delta)\sigma}{(\mu+\sigma)(\alpha + \gamma + \mu)}. \end{aligned}

If you would like to examine a more simple model, without birth and death rates, immunity loss, and incubation periods, then check out the SIR model solver webpage.

Simulation parameter form.
Parameter Value Explanation
Death by infection rate.
A parameter that pertains to how many contacts there are per person and how easily the disease spreads from an infected person to an uninfected person.
A parameter that is a measure of how quickly people recover from the disease.
A parameter with values from 0 to 1 pertaining to how effective quarantine measures are at slowing the disease outbreak. If δ=0\delta = 0, the measures are either non-existent or completely ineffective. If δ=1\delta = 1, all infected persons are immediately, as soon as they become infected, quarantined.
Birth rate.
Baseline death rate, irrespective of infection.
Inverse of incubation period.
Rate of immunity loss in recovered individuals.
End time of simulation.
Initial number of susceptible individuals.
Initial number of exposed individuals.
Initial number of infected individuals.
Initial number of recovered individuals.
Error tolerance for our numerical solution to the SIR equations.
Tolerance type, can be either absolute (0) or relative (1).
Initial step size.
Minimum allowed step size.
Time increment for skipping ahead in animation.
Time you want to skip ahead to in animation when you press the skip button.
Width (in px) of Plotly windows used for plotting and animation below.
Height (in px) of Plotly windows used for plotting and animation below.
Proportion of animation time passed per real time. tScale=1.0t_{\mathrm{Scale}}=1.0 means animation and real time match. tScale<1.0t_{\mathrm{Scale}}<1.0 means the animation is going more slowly than real time. tScale>1.0t_{\mathrm{Scale}}>1.0 means it is going more rapidly.
Opacity of the lines in the 3D phase space animation. Customizable in case you need to tweak it in order to see the red dot marker.

Reference list

Bjørnstad ON, Shea K, Krzywinski M, & Altman N (2020). The SEIRS model for infectious disease dynamics. Nature Methods, 17(6): 557–558. doi: 10.1038/s41592-020-0856-2. PMID 32499633.