Table of Contents
Fetching ...

A Categorical Framework for Modeling with Stock and Flow Diagrams

John C. Baez, Xiaoyan Li, Sophie Libkind, Nathaniel D. Osgood, Eric Redekopp

TL;DR

The paper addresses the rigidity and opacity of traditional stock-flow modeling and proposes a category-theoretic framework to separate diagram syntax from semantics. It defines a category StockFlow, along with functorial semantics to ODEs, causal loop diagrams, and system-structure diagrams, enabling modular composition and pullback-based stratification. The authors implement these ideas in StockFlow.jl and showcase ModelCollab for real-time collaboration, including SEIR models and typed stratification, with the SEIR ODEs explicitly demonstrated by $dS/dt$, $dE/dt$, $dI/dt$, $dR/dt$ equations. They discuss practical benefits for modularity, reuse, and multi-analytic perspectives in health dynamics, and outline future extensions to stochastic and higher-dimensional semantics.

Abstract

Stock and flow diagrams are already an important tool in epidemiology, but category theory lets us go further and treat these diagrams as mathematical entities in their own right. In this chapter we use communicable disease models created with our software, StockFlow.jl, to explain the benefits of the categorical approach. We first explain the category of stock-flow diagrams and note the clear separation between the syntax of these diagrams and their semantics, demonstrating three examples of semantics already implemented in the software: ODEs, causal loop diagrams, and system structure diagrams. We then turn to two methods for building large stock-flow diagrams from smaller ones in a modular fashion: composition and stratification. Finally, we introduce the open-source ModelCollab software for diagram-based collaborative modeling. The graphical user interface of this web-based software lets modelers take advantage of the ideas discussed here without any knowledge of their categorical foundations.

A Categorical Framework for Modeling with Stock and Flow Diagrams

TL;DR

The paper addresses the rigidity and opacity of traditional stock-flow modeling and proposes a category-theoretic framework to separate diagram syntax from semantics. It defines a category StockFlow, along with functorial semantics to ODEs, causal loop diagrams, and system-structure diagrams, enabling modular composition and pullback-based stratification. The authors implement these ideas in StockFlow.jl and showcase ModelCollab for real-time collaboration, including SEIR models and typed stratification, with the SEIR ODEs explicitly demonstrated by , , , equations. They discuss practical benefits for modularity, reuse, and multi-analytic perspectives in health dynamics, and outline future extensions to stochastic and higher-dimensional semantics.

Abstract

Stock and flow diagrams are already an important tool in epidemiology, but category theory lets us go further and treat these diagrams as mathematical entities in their own right. In this chapter we use communicable disease models created with our software, StockFlow.jl, to explain the benefits of the categorical approach. We first explain the category of stock-flow diagrams and note the clear separation between the syntax of these diagrams and their semantics, demonstrating three examples of semantics already implemented in the software: ODEs, causal loop diagrams, and system structure diagrams. We then turn to two methods for building large stock-flow diagrams from smaller ones in a modular fashion: composition and stratification. Finally, we introduce the open-source ModelCollab software for diagram-based collaborative modeling. The graphical user interface of this web-based software lets modelers take advantage of the ideas discussed here without any knowledge of their categorical foundations.
Paper Structure (10 sections, 5 equations, 23 figures)

This paper contains 10 sections, 5 equations, 23 figures.

Figures (23)

  • Figure 1: The stock-flow diagram of the open population SEIR model
  • Figure 2: The schema for stock-flow diagrams
  • Figure 3: The categorical database structure representing the stock-flow diagram associated with the SEIR model
  • Figure 4: An example solution of the ODEs of the SEIR stock-flow diagram
  • Figure 5: The schema for causal loop diagrams
  • ...and 18 more figures