Scaling of Epidemiology Models with Multi-site Compartments

Anton Antonov
Accendo Data LLC

Introduction

In this notebook we describe and exemplify an algorithm that allows the specification and execution of geo-spatial-temporal simulations of infectious disease spreads. (Concrete implementations and examples are given.)
The assumptions of the typical compartmental epidemiological models do not apply for countries or cities that are nonuniformly populated (for example, China, USA and Russia). There is a need to derive epidemiological models that take into account the nonuniform distribution of populations and related traveling patterns within the area of interest.
Here is a visual aid (made with a random graph over the 30 largest cities of China):
In this notebook we show how to extend core, single-site epidemiological models into larger models for making spatial-temporal simulations. In the explanations and examples we use SEI2R [AA2, AAp1] as a core epidemiological model, but other models can be adopted if they adhere to the model data structure of the package "EpidemiologyModels.m" [AAp1].
From our experiments, we believe that the proposed multi-site extension algorithm gives a modeling ingredient that is hard emulate by other means within single-site models.

Definitions

Single site: A geographical location (city, neighbourhood, campus) for which the assumptions of the classical compartmental epidemiological models hold.
Single-site epidemiological model: A compartmental epidemiological model for a single site. Such model has a system of ordinary differential equations (ODEs) and site-dependent initial conditions.
Multi-site area: An area comprised of multiple single sites with known traveling patterns between them. The area has a directed graph
G
with nodes that correspond to the sites and a positive matrix
tpm(G)
for the traveling patterns between the sites.
Problem definition: Given (i) a single site epidemiological model
M
, (ii) a graph
G
connecting multiple sites and (iii) a traveling patterns matrix
tpm(G)
between the nodes of
G
, derive an epidemiological model
S(M,tpm(G))
that simulates more adequately viral decease propagation over
G
.
Multi-Site Epidemiological Model Extension Algorithm (MSEMEA): An algorithm that derives from a given single site epidemiological model and multi-site area an epidemiological model that can be used to simulate the geo-spatial-temporal epidemics and infectious disease spreads. (The description of MSEMEA is the main message of this notebook.)

Load Packages

The epidemiological models framework used in this notebook is implemented with the packages [AAp1, AAp2, AA3]; the interactive plots functions are from the package [AAp4].
Import["https://raw.githubusercontent.com/antononcube/SystemModeling/master/Projects/Coronavirus-propagation-dynamics/WL/EpidemiologyModels.m"]​​Import["https://raw.githubusercontent.com/antononcube/SystemModeling/master/Projects/Coronavirus-propagation-dynamics/WL/EpidemiologyModelModifications.m"]​​Import["https://raw.githubusercontent.com/antononcube/SystemModeling/master/Projects/Coronavirus-propagation-dynamics/WL/EpidemiologyModelingVisualizationFunctions.m"]​​Import["https://raw.githubusercontent.com/antononcube/SystemModeling/master/WL/SystemDynamicsInteractiveInterfacesFunctions.m"]
In[]:=

Notebook Structure

The section “General Algorithm Description” gives rationale and conceptual steps of MSEMEA.
The next two sections of the notebook follow the procedure outline using the SEI2R model as
M
, a simple graph with two nodes as
G
and both constant and time-dependent matrices for
tpm(G)
.
The section “Constant Traveling Patterns over a Grid Graph” presents an important test case with a grid graph that we use to test and build confidence in MSEMEA. The subsection “Observations” is especially of interest.
The section “Time-Dependent Traveling Patterns over a Random Graph” presents a nearly “real-life” application of MSEMEA using a random graph and a time-dependent traveling patterns matrix.
The section “Money from Lost Productivity” shows how to track the money losses across the sites.
The last section, “Future Plans,” outlines envisioned (immediate) extensions work presented in this notebook.

General Algorithm Description

In this section we describe a modeling approach that uses different mathematical modeling approaches for (i) the multi-site traveling patterns and (ii) the single-site disease spread interactions, and then (iii) unifies them into a common model.

Splitting and Scaling

The traveling between large, densely populated cities is a very different process than the usual people mingling in those cities. The usual large, dense city mingling is assumed and used in the typical compartmental epidemiological models. It seems it is a good idea to split the two processes and derive a common model.
Assume that all journeys finish within a day. We can model the people arriving (flying in) to a city as births and people departing a city as deaths.
Let as take a simple model like SIR or SEIR and write the equation for every site we consider. This means for every site we have the same ODEs with site-dependent initial conditions.
Consider the traveling patterns matrix
K
, which is a contingency matrix derived from source-destination traveling records (or the adjacency matrix of a travelling patterns graph). The matrix entry of
K(i,j)
tells us how many people traveled from site
i
to site
j
. We systematically change the ODEs of the sites in following way.
Assume that site
a
had only travelers coming from site
b
and going to site
b
. Assume that the Total Population (TP) sizes for sites
a
and
b
are
N
a
and
N
b
, respectively. Assume that only people from the Susceptible Population (SP) traveled. If the adopted single-site model is SIR, [Wk1], we take the SP equation of site
a
,
′
SP
a
(t)-
β
IP
a
(t)
SP
a
(t)
N
a
-
SP
a
(t)μ,
(1)
and change into the equation
′
SP
a
(t)-
β
IP
a
(t)
SP
a
(t)
N
a
-
SP
a
(t)μ-
K(a,b)
SP
a
(t)
N
a
+
K(b,a)
SP
b
(t)
N
b
,
(2)
assuming that
K(a,b)
SP
a
(t)
N
a
≤
N
a
,​​
K(b,a)
SP
b
(t)
N
b
≤
N
b
.
(3)
Remark: In the package [AAp3], the transformations above are done with the more general and robust formula:
min
K(i,j)
SP
i
(t)
TP
i
(t)
,
TP
i
(t).
(4)
The transformed systems of ODEs of the sites are joined into one “big” system of ODEs, appropriate initial conditions are set and the “big” ODE system is solved. (The sections below show concrete examples.)

Steps of MSEMEA

MSEMEA derives a compartmental model that combines (i) a graph representation of multi-site traveling patterns with (ii) a single-site compartmental epidemiological model.
Here is a visual aid for the algorithm steps below:
CompoundExpression[
]
Out[]=
Get a single-site epidemiological compartmental model data structure
M
.
1.
The model data structure has stocks and rates dictionaries, equations, initial conditions and prescribed rate values; see [AA2, AAp1].
1.1.
Derive the site-to-site traveling patterns matrix
K
for the sites in the graph
G
.
2.
For each of node
i
of
G
, make a copy of the model
M
and denote with
M[i]
.
3.
In general, the models
M[i],i∈G
have different initial conditions.
3.1.
The models can also have different death rates, contact rates, etc.
3.2.
Combine the models
M[i],i∈G
into the scaled model
S
.
4.
Change the equations of
M[i]
,
i∈G
to reflect the traveling patterns matrix
K
.
4.1.
Join the systems of ODEs of
M[i]
,
i∈G
into one system of ODEs.
4.2.
Set appropriate or desired initial conditions for each of the populations in
S
.
5.
Solve the ODEs of
S
.
6.
Visualize the results.
7.

Precaution

Care should be taken when specifying the initial conditions of MSEMEA’s system of ODEs (sites’ populations) and the traveling patterns matrix. For example, the simulations can “blow up” if the traveling patterns matrix values are too large. As it was indicated above, the package [AAp3] puts in some safeguards, but in our experiments with random graphs and random traveling patterns matrices, occasionally we still get “wild” results.

Analogy with Large-Scale Air Pollution Modeling

There is a strong analogy between MSEMEA and Eulerian models of Large-Scale Air Pollution Modeling (LSAPM), [AA3, ZZ1].
The mathematical models of LSAPM have a “chemistry part” and an “advection-diffusion part.” It is hard to treat such mathematical model directly—different kinds of splittings are used. If we consider 2D LSAPM, then we can say that we cover the modeling area with steer tank reactors, then with the chemistry component we simulate the species chemical reactions in those steer tanks, and with the advection-diffusion component we change species concentrations in the steer tanks (according to some wind patterns).
Similarly, with MSEMEA we separated the travel of population compartments from the “standard” epidemiological modeling interaction between the population compartments.
Similarly to the so-called “rotational test” used in LSAPM to evaluate numerical schemes, we derive and study the results of “grid graph tests” for MSEMEA.

Single-Site Epidemiological Model

Here is the SEI2R model from the package [AAp1]:
model1=SEI2RModel[t,"InitialConditions"True,"RateRules"True,"TotalPopulationRepresentation""AlgebraicEquation"];​​ModelGridTableForm[model1]
Stocks
#
Symbol
Description
1
TP[t]
Total Population
2
SP[t]
Susceptible Population
3
EP[t]
Exposed Population
4
INSP[t]
Infected Normally Symptomatic Population
5
ISSP[t]
Infected Severely Symptomatic Population
6
RP[t]
Recovered Population
7
MLP[t]
Money of Lost Productivity
,Rates
#
Symbol
Description
1
μ[TP]
Population death rate
2
μ[INSP]
Infected Normally Symptomatic Population death rate
3
μ[ISSP]
Infected Severely Symptomatic Population death rate
4
sspf[SP]
Severely Symptomatic Population Fraction
5
β[INSP]
Contact rate for the normally symptomatic population
6
β[ISSP]
Contact rate for the severely symptomatic population
7
aip
Average infectious period
8
aincp
Average incubation period
9
lpcr[ISSP,INSP]
Lost productivity cost rate (per person per day)
,Equations
#
Equation
1
′
SP
t-
INSP[t]SP[t]β[INSP]
TP[t]
-
ISSP[t]SP[t]β[ISSP]
TP[t]
-SPtμTP
2
′
EP
t
INSP[t]SP[t]β[INSP]
TP[t]
+
ISSP[t]SP[t]β[ISSP]
TP[t]
-EPt
1
aincp
+μTP
3
′
INSP
t-
INSP[t]
aip
+
EP[t](1-sspf[SP])
aincp
-INSPtμINSP
4
′
ISSP
t-
ISSP[t]
aip
+
EP[t]sspf[SP]
aincp
-ISSPtμISSP
5
′
RP
t
INSP[t]+ISSP[t]
aip
-RPtμTP
6
′
MLP
[t]lpcr[ISSP,INSP](-RP[t]-SP[t]+TP[t])
7
TP[t]Max[0,EP[t]+INSP[t]+ISSP[t]+RP[t]+SP[t]]
,RateRules
#
Symbol
Value
1
μTP
1
45625
2
μISSP
0.035
aip
3
μINSP
0.01
aip
4
β[ISSP]
6
5
β[INSP]
3
6
aip
28
7
aincp
6
8
sspf[SP]
0.2
9
lpcr[ISSP,INSP]
600
,InitialConditions
#
Equation
1
SP[0]99998
2
EP[0]0
3
ISSP[0]1
4
INSP[0]1
5
RP[0]0
6
MLP[0]0
7
TP[0]100000

Out[]=
Here we endow the SEI2R model with a (prominent) ID:
ModelGridTableForm[AddModelIdentifier[model1,1]]
Stocks
#
Symbol
Description
1
TP[1][t]
Total Population
2
SP[1][t]
Susceptible Population
3
EP[1][t]
Exposed Population
4
INSP[1][t]
Infected Normally Symptomatic Population
5
ISSP[1][t]
Infected Severely Symptomatic Population
6
RP[1][t]
Recovered Population
7
MLP[1][t]
Money of Lost Productivity
,Rates
#
Symbol
Description
1
μ[1][TP]
Population death rate
2
μ[1][INSP]
Infected Normally Symptomatic Population death rate
3
μ[1][ISSP]
Infected Severely Symptomatic Population death rate
4
sspf[1][SP]
Severely Symptomatic Population Fraction
5
β[1][INSP]
Contact rate for the normally symptomatic population
6
β[1][ISSP]
Contact rate for the severely symptomatic population
7
aip[1]
Average infectious period
8
aincp[1]
Average incubation period
9
lpcr[1][ISSP,INSP]
Lost productivity cost rate (per person per day)
,Equations
#
Equation
1
′
SP[1]
t-
INSP[1][t]SP[1][t]β[1][INSP]
TP[1][t]
-
ISSP[1][t]SP[1][t]β[1][ISSP]
TP[1][t]
-SP1tμ1TP
2
′
EP[1]
t
INSP[1][t]SP[1][t]β[1][INSP]
TP[1][t]
+
ISSP[1][t]SP[1][t]β[1][ISSP]
TP[1][t]
-EP1t
1
aincp[1]
+μ1TP
3
′
INSP[1]
t-
INSP[1][t]
aip[1]
+
EP[1][t](1-sspf[1][SP])
aincp[1]
-INSP1tμ1INSP
4
′
ISSP[1]
t-
ISSP[1][t]
aip[1]
+
EP[1][t]sspf[1][SP]
aincp[1]
-ISSP1tμ1ISSP
5
′
RP[1]
t
INSP[1][t]+ISSP[1][t]
aip[1]
-RP1tμ1TP
6
′
MLP[1]
[t]lpcr[1][ISSP,INSP](-RP[1][t]-SP[1][t]+TP[1][t])
7
TP[1][t]Max[0,EP[1][t]+INSP[1][t]+ISSP[1][t]+RP[1][t]+SP[1][t]]
,RateRules
#
Symbol
Value
1
μ1TP
1
45625
2
μ1ISSP
0.035
aip[1]
3
μ1INSP
0.01
aip[1]
4
β[1][ISSP]
6
5
β[1][INSP]
3
6
aip[1]
28
7
aincp[1]
6
8
sspf[1][SP]
0.2
9
lpcr[1][ISSP,INSP]
600
,InitialConditions
#
Equation
1
SP[1][0]99998
2
EP[1][0]0
3
ISSP[1][0]1
4
INSP[1][0]1
5
RP[1][0]0
6
MLP[1][0]0
7
TP[1][0]100000

Out[]=
Thus we demonstrated that we can do step 3 of MSEMEA.
Below we use IDs that correspond to the nodes of graphs (and are integers.)

Scaling the Single-Site SIR Model over a Small Complete Graph

Constant Travel Matrices

Assume we have two sites and the following graph and matrix describe the traveling patterns between them.
Here is the graph:
gr=CompleteGraph[2,DirectedEdgesTrue,GraphLayout"SpringElectricalEmbedding"]
Out[]=
And here is the traveling patterns matrix:
SeedRandom[44];​​matTravel=AdjacencyMatrix[gr]*RandomInteger[{100,1000},{VertexCount[gr],VertexCount[gr]}];​​MatrixForm[matTravel]

0
623
224
0

Note that there are many more travelers from 1 to 2 than from 2 to 1.
Here we obtain the core, single-site model (as shown in the section above):
model1=SEI2RModel[t,"InitialConditions"True,"RateRules"True,"TotalPopulationRepresentation""AlgebraicEquation"];
In[]:=
Make the multi-site compartments model with SEI2R and the two-node travel matrix using the function ToSiteCompartmentsModel of [AAp2]:
modelBig=ToSiteCompartmentsModel[model1,matTravel,"MigratingPopulations"{"Susceptible Population","Exposed Population","Infected Normally Symptomatic Population","Recovered Population"}];
In[]:=
Show the unique stocks in the multi-site model:
GetPopulationSymbols[modelBig,__~~__]
{TP[1],SP[1],EP[1],INSP[1],ISSP[1],RP[1],MLP[1],TP[2],SP[2],EP[2],INSP[2],ISSP[2],RP[2],MLP[2]}
Out[]=
From the symbolic form of the multi-model equations derive the specific equations with the adopted rate values:
ModelGridTableForm[KeyTake[modelBig,{"Equations"}]//.modelBig["RateRules"]]
Equations
#
Equation
1
′
SP[1]
t-Min
623SP[1][t]
TP[1][t]
,TP1t+Min
224SP[2][t]
TP[2][t]
,TP2t-
SP[1][t]
45625
-
3INSP[1][t]SP[1][t]
TP[1][t]
-
6ISSP[1][t]SP[1][t]
TP[1][t]
2
′
EP[1]
t-Min
623EP[1][t]
TP[1][t]
,TP1t+Min
224EP[2][t]
TP[2][t]
,TP2t-
45631EP[1][t]
273750
+
3INSP[1][t]SP[1][t]
TP[1][t]
+
6ISSP[1][t]SP[1][t]
TP[1][t]
3
′
INSP[1]
t-Min
623INSP[1][t]
TP[1][t]
,TP1t+Min
224INSP[2][t]
TP[2][t]
,TP2t+0.133333EP1t-0.0360714INSP1t
4
′
ISSP[1]
[t]0.0333333EP[1][t]-0.0369643ISSP[1][t]
5
′
RP[1]
t-Min
623RP[1][t]
TP[1][t]
,TP1t+Min
224RP[2][t]
TP[2][t]
,TP2t+
1
28
INSP1t+ISSP1t-
RP[1][t]
45625
6
′
MLP[1]
[t]600(-RP[1][t]-SP[1][t]+TP[1][t])
7
TP[1][t]Max[0,EP[1][t]+INSP[1][t]+ISSP[1][t]+RP[1][t]+SP[1][t]]
8
′
SP[2]
tMin
623SP[1][t]
TP[1][t]
,TP1t-Min
224SP[2][t]
TP[2][t]
,TP2t-
SP[2][t]
45625
-
3INSP[2][t]SP[2][t]
TP[2][t]
-
6ISSP[2][t]SP[2][t]
TP[2][t]
9
′
EP[2]
tMin
623EP[1][t]
TP[1][t]
,TP1t-Min
224EP[2][t]
TP[2][t]
,TP2t-
45631EP[2][t]
273750
+
3INSP[2][t]SP[2][t]
TP[2][t]
+
6ISSP[2][t]SP[2][t]
TP[2][t]
10
′
INSP[2]
tMin
623INSP[1][t]
TP[1][t]
,TP1t-Min
224INSP[2][t]
TP[2][t]
,TP2t+0.133333EP2t-0.0360714INSP2t
11
′
ISSP[2]
[t]0.0333333EP[2][t]-0.0369643ISSP[2][t]
12
′
RP[2]
tMin
623RP[1][t]
TP[1][t]
,TP1t-Min
224RP[2][t]
TP[2][t]
,TP2t+
1
28
INSP2t+ISSP2t-
RP[2][t]
45625
13
′
MLP[2]
[t]600(-RP[2][t]-SP[2][t]+TP[2][t])
14
TP[2][t]Max[0,EP[2][t]+INSP[2][t]+ISSP[2][t]+RP[2][t]+SP[2][t]]

Out[]=
Show the initial conditions:
RandomSample[modelBig["InitialConditions"],UpTo[12]]
{ISSP[2][0]1,TP[1][0]100000,EP[2][0]0,EP[1][0]0,SP[1][0]99998,RP[2][0]0,RP[1][0]0,INSP[1][0]1,INSP[2][0]1,TP[2][0]100000,SP[2][0]99998,MLP[1][0]0}
Out[]=
Show the total number of equations:
Length[modelBig["Equations"]]
14
Out[]=
Solve the system of ODEs of the extended model:
maxTime=120;​​AbsoluteTiming[​​aSol=Association@First@​​NDSolve[​​Join[modelBig["Equations"]//.modelBig["RateRules"],modelBig["InitialConditions"]],​​GetStockSymbols[modelBig,__~~"Population"],​​{t,0,maxTime}​​];​​];​​Length[aSol]
12
Out[]=
Display the solutions for each site separately:
ParametricSolutionsPlots[modelBig["Stocks"],#,None,maxTime,"Together"True,PlotTheme"Detailed",ImageSizeMedium]&/@GroupBy[Normal@aSol,#〚1,1〛&,Association]
Out[]=
From the plots above, we see that both sites start with total populations of 100,000 people. Because more travelers go from 1 to 2, we see that the exposed, infected and recovered populations are larger at 2.

Time-Dependent Travel Matrices

Instead of using constant traveling patterns matrices, we can use matrices with time functions as entries. It is instructive to repeat the computations above using this matrix:
SeedRandom[232]​​matTravel2=matTravel*Table[Abs[Sin[RandomReal[{0.01,0.1}]t]],VertexCount[gr],VertexCount[gr]];​​MatrixForm[matTravel2]
0
623Abs[Sin[0.0679462t]]
224Abs[Sin[0.0730582t]]
0
Out[]//MatrixForm=
Here are the corresponding number of traveling people functions:
Plot[Evaluate[DeleteCases[Flatten@Normal@matTravel2,0]],{t,0,120},PlotTheme"Detailed"]
Out[]=
Here we scale the SIR model, solve the obtained system of ODEs and plot the solutions:
modelBig=ToSiteCompartmentsModel[model1,matTravel2,"MigratingPopulations"{"Susceptible Population","Exposed Population","Infected Normally Symptomatic Population","Recovered Population"}];​​aSol=Association@First@​​NDSolve[​​Join[modelBig["Equations"]//.modelBig["RateRules"],modelBig["InitialConditions"]],​​GetStockSymbols[modelBig,__~~""],​​{t,0,maxTime}​​];​​ParametricSolutionsPlots[modelBig["Stocks"],#,None,120,"Together"True,PlotTheme"Detailed",ImageSizeMedium]〚1〛&/@GroupBy[Normal@KeySelect[aSol,!MemberQ[{MLP},Head[#]]&],#〚1,1〛&,Association]
Out[]=
Note that the oscillatory nature of the temporal functions in the travelling patterns matrix are reflected in the simulation results.

Constant Traveling Patterns over a Grid Graph

In this section we do the model extension and simulation over a regular grid graph with a constant traveling patterns matrix.
Here we create a grid graph with directed edges:
{m,n}={7,12};​​grGrid=GridGraph[{m,n},DirectedEdgesTrue,GraphLayout"SpringEmbedding",VertexLabelsAutomatic,ImageSizeLarge]
Out[]=
Note that:
  • There is one directed edge between any two edge-connected nodes.
  • ◼
  • All horizontal edges point in one direction.
  • ◼
  • All vertical edges point in one direction.
  • ◼
  • The edges are directed from nodes with smaller indexes to nodes with larger indexes.
  • ◼
    Here we make a constant traveling matrix and summarize it:
    matGridTravel=AdjacencyMatrix[grGrid]*ConstantArray[1000,{VertexCount[grGrid],VertexCount[grGrid]}];​​{ResourceFunction["RecordsSummary"][Flatten[matGridTravel],"All elements"]〚1〛,ResourceFunction["RecordsSummary"][Sel