# Message Boards

Answer
(Unmark)

GROUPS:

5

# [NB] Scaling of epidemiology models with multi-site compartments

Posted 1 year ago

Introduction In this notebook we describe and exemplify an algorithm that allows the specification and execution 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 non-uniformly populated. (For example, China, USA, Russia.) There is a need to derive epidemiological models that take into account the non-uniform 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 with 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 (ODE’s) 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 tpm(G) Problem definition: Given (i) a single site epidemiological model M G tpm(G) G S(M,tpm(G)) 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-propagation-dynamics/WL/EpidemiologyModels.m"]Import["https://raw.githubusercontent.com/antononcube/SystemModeling/master/Projects/Coronavirus-propagation-dynamics/WL/EpidemiologyModelModifications.m"]Import["https://raw.githubusercontent.com/antononcube/SystemModeling/master/Projects/Coronavirus-propagation-dynamics/WL/EpidemiologyModelingVisualizationFunctions.m"]Import["https://raw.githubusercontent.com/antononcube/SystemModeling/master/WL/SystemDynamicsInteractiveInterfacesFunctions.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 G 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 sub-section “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 travelling 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 travelling 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 of 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) into 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 ODE’s with site-dependent initial conditions. Consider the traveling patterns matrix K K(i,j) i j Assume that site a b b a b N a N b a ′ SP a β IP a SP a N a SP a ( 1 )and change into the equation ′ SP a β IP a SP a N a SP a K(a,b) SP a N a K(b,a) SP b N b ( 2 )assuming that K(a,b) SP a N a N a K(b,a) SP b 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 TP i TP i ( 4 )The transformed systems of ODE’s of the sites are joined into one “big” system of ODE’s, 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:
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 G 2 .For each of node i G M M[i] 3 .In general, the models M[i],i∈G 3 .1 .The models can also have different death rates, contact rates, etc. 3 .2 .Combine the models M[i],i∈G S 4 .Change the equations of M[i] i∈G K 4 .1 .Join the systems of ODE’s of M[i] i∈G 4 .2 .Set appropriate or desired initial conditions for each of the populations in S 5 .Solve the ODE’s of S 6 .Visualize the results. 7 .
Precaution Care should be taken when specifying the initial conditions of MSEMEA’s system of ODE’s (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 some safe-guards, 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
Out[]= Here we endow the SEI2R model with a (prominent) ID: ModelGridTableForm[AddModelIdentifier[model1,1]] Stocks
Out[]= Thus we demonstrated that we can do Step 3 of MSEMEA. Below we use ID’s 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,DirectedEdgesTrue,GraphLayout"SpringElectricalEmbedding"] Out[]= And here is the traveling patterns matrix: SeedRandom[44];matTravel=AdjacencyMatrix[gr]*RandomInteger[{100,1000},{VertexCount[gr],VertexCount[gr]}];MatrixForm[matTravel]
Out[]//MatrixForm= Note that there are much 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
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 ODE’s 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",ImageSizeMedium]&/@GroupBy[Normal@aSol,#〚1,1〛&,Association] 1
Out[]= From the plots above we see that both sites start with total populations of 100000
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]
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 ODE’s, 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",ImageSizeMedium]〚1〛&/@GroupBy[Normal@KeySelect[aSol,!Member |