Node-RED flows to implement compartmental models for contagious disease. The compartments used are:
- S = susceptible
- E = exposed
- I = infectious
- R= recovered
- D = deceased
The models implemented are SIR, SIRD, SEIR, and SEIRD. The rate equations (ordinary differential equations) representing transitions between the compartments are solved by the finite difference method, with a step size of 0.01 days. The populations of the compartments are represented by the time-dependent variables s,e,i,r,d, which are the fractions of the total population in each compartment. The system is initialized at t = 0 with i = 0.001 and s = 0.999.
The models assume that the population is uniform and homogeneously mixed and that recovered individuals (compartment R) are immune to re-infection. The time period simulated is assumed to be brief enough that births and deaths (other than from the disease being modeled) can be neglected.
SIR
- rate(S -> I) = beta * i * s
- rate(I -> R) = gamma * i
SIRD
- rate(S -> I) = beta * i * s
- rate(I -> R) = (1 - alpha) * gamma * i
- rate(I -> D) = alpha * rho * i
SEIR
- rate(S -> E) = beta * i * s
- rate(E -> I) = delta * e
- rate(I -> R) = gamma * i
SEIRD
- rate(S -> E) = beta * i * s
- rate(E -> I) = delta * e
- rate(I -> R) = (1 - alpha) * gamma * i
- rate(I -> D) = alpha * rho * i
where
- R0 = basic reproduction number
- I = incubation period (days)
- delta = 1/I
- D = contagious period (days)
- gamma = 1/D
- beta = R0 * gamma
- H = treatment period (days)
- rho = 1/H
- alpha = fatality rate
Consensus values in the COVID-19 literature seem to be approximately: R0 = 2.5, D = 6 days, I = 2 days, H = 14 days, alpha = 0.05 - 0.1
Note: alpha is not equal to the conventional infection fatality rate, IFR. The two are related by
alpha = H / (D / IFR - D + H).
If IFR << 1, then to a good approximation,
alpha โ IFR * H / D, or IFR โ D * alpha / H.
Contagion Models: allows the user to compare the results of two models, with the type and parameters selected independently.
Interventions: shows the result of imposing or modifying interventions (lockdown or social distancing), defined by changes in R0 at a specified times.