Skip to the Main Content

Note:These pages make extensive use of the latest XHTML and CSS Standards. They ought to look great in any standards-compliant modern browser. Unfortunately, they will probably look horrible in older browsers, like Netscape 4.x and IE 4.x. Moreover, many posts use MathML, which is, currently only supported in Mozilla. My best suggestion (and you will thank me when surfing an ever-increasing number of sites on the web which have been crafted to use the new standards) is to upgrade to the latest version of your browser. If that's not possible, consider moving to the Standards-compliant and open-source Mozilla browser.

May 3, 2023

Compositional Epidemiology

Posted by John Baez

To give a talk at Applied Category Theory 2023 you have to submit an unpublished paper or an abstract. Here’s a draft of an abstract that I plan to submit. Take it as a quick summary of many things I should be blogging about!

If this talk is accepted it will be called “Software for Compositional Modeling in Epidemiology”. It’s about work by Xiaoyan Li, Sophie Libkind, Nathaniel D. Osgood, Eric Redekopp and me. The abstract is a bit dry but it efficiently says what we’ve been up to. The talk will be more fun.

Software for compositional modeling in epidemiology

Mathematical models of disease are important and widely used, but building and working with these models at scale is challenging. Many epidemiologists use ‘stock and flow diagrams’ to describe ordinary differential equation (ODE) models of disease dynamics. In this talk we describe and demonstrate two software tools for working with such models. The first, called StockFlow.jl, is based on category theory and written in AlgebraicJulia. The second, called ModelCollab, runs on a web browser and serves as a graphical user interface for StockFlow.jl. Using ModelCollab requires no knowledge of Julia or category theory. This feature should be useful in “participatory modeling”, an approach where models are built with the help of diverse stakeholders [H]. However, as we continue to introduce new features in StockFlow.jl, it takes some time for them to be implemented in ModelCollab.

A stock and flow diagram uniquely specifies a system of first-order ODEs. Once a model of this sort has been built, modeling typically alternates between assessing scenario outcomes resulting from numerically integrating these ODEs, performing other analyses, and elaborating the stock and flow diagram. Two common ways to elaborate a stock and flow diagram are to attach it to other such diagrams (“composition”) and to subdivide population groups into smaller groups with distinct characteristics (“stratification”).

Modelers often regard stock and flow diagrams as an informal step toward a mathematically rigorous formulation of a model in terms of ODEs. However, stock and flow diagrams have a precise mathematical syntax. In particular, stock and flow diagrams are objects in a category StockFlow,\mathsf{StockFlow}, and open stock and flow diagrams are horizontal 1-cells in a decorated cospan double category 𝕆pen(StockFlow),\mathbb{O}\!\mathbf{pen}(\mathsf{StockFlow}), which is built from StockFlow\mathsf{StockFlow} by a decorated cospan construction. Formalizing the syntax using category theory has many advantages. In this talk we focus on three:

1. Functorial Semantics

Our software lets modelers separate the syntax of stock and flow diagrams from their semantics: that is, the various uses to which these diagrams are put. Different choices of semantics are described via different functors. In addition to the ODE semantics, we have implemented functors that turn stock and flow diagrams into other diagrams that are widely used in the modeling methodology called System Dynamics [H,S]. These other forms of semantics capture purely qualitative features of stock and flow models.

2. Composition

ModelCollab provides a structured way to build complex stock and flow diagrams by composing small reusable pieces. These pieces are open stock and flow diagrams. Our software allows for operadic composition of open stock and flow diagrams. It lets users save these diagrams and retrieve them for reuse as parts of various larger models. Since it can run on multiple web browsers, it lets members of a modeling team build these models collaboratively.


Example of composing stock and flow diagrams by identifying stocks in ModelCollab.

3. Stratification

Our software also allows users to stratify models: that is, refine them by subdividing a single population (stock) into several smaller populations with distinct features. In contrast to the global changes commonly required to stratify stock and flow diagrams, our software lets users crisply characterize a stratified diagram as a pullback of simpler diagrams, which again can be saved for reuse. This feature uses pullbacks in a presheaf category whose objects are “system structure diagrams”. These are like stock and flow diagrams, but lacking the quantitative information describing the rates of flows. After a system structure diagram has been constructed, this information can be added to obtain a stock and flow diagram.

References

[AJ] AlgebraicJulia: Bringing compositionality to technical computing.

[B1] J. Baez, K. Courser and C. Vasilakopoulou, Structured versus decorated cospans, Compositionality 4 3 (2022).

[B2] J. C. Baez, X. Li, S. Libkind, N. D. Osgood and E. Patterson, Compositional modeling with stock and flow diagrams. To appear in Proceedings of Applied Category Theory 2022.

[B3] J. C. Baez, X. Li, S. Libkind, N. D. Osgood and E. Redekopp, A categorical framework for modeling with stock and flow diagrams, to appear in Mathematics for Public Health, Springer, Berlin.

[F] B. Fong, Decorated cospans, Theory and Applications of Categories 30 (2015), 1096–1120.

[H] P. S. Hovmand, Community Based System Dynamics, Springer, Berlin, 2014.

[L] S. Libkind, A. Baas, M. Halter, E. Patterson and J. P. Fairbanks, An algebraic framework for structured epidemic modelling, Philosophical Transactions of the Royal Society A 380 (2022), 20210309.

[MC] ModelCollab: A web-based application for collaborating on simulation models in real-time using Firebase.

[S] J. D. Sterman, Business Dynamics, McGraw-Hill, New York, 2000.

[SF] Stockflow.jl.

Posted at May 3, 2023 12:41 AM UTC

TrackBack URL for this Entry:   https://golem.ph.utexas.edu/cgi-bin/MT-3.0/dxy-tb.fcgi/3465

0 Comments & 0 Trackbacks

Post a New Comment