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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
The code can also be found in the GitHub repository https://github.com/Xiaoyan-Li/applicationStockFlowMFPH.
References
AlgebraicJulia: Bringing compositionality to technical computing. https://www.algebraicjulia.org
Anderson, R.M., May, R.M.: Infectious Diseases of Humans: Dynamics and Control. Oxford University Press, Oxford (1992)
Andrieu, C., Doucet, A., Holenstein, R.: Particle Markov chain Monte Carlo methods. J. R. Stat. Soc. B (Statistical Methodology) 72(3), 269–342 (2010)
Arulampalam, M.S., Maskell, S., Gordon, N., Clapp, T.: A tutorial on particle filters for online nonlinear/non-Gaussian Bayesian tracking. IEEE Trans. Signal Process. 50(2), 174–188 (2002)
Baez, J.C., Courser, K.: Structured cospans. Theor. Appl. Categ. 35(48), 1771–1822 (2020). arXiv:1911.04630
Baez, J.C., Courser, K., Vasilakopoulou, C.: Structured versus decorated cospans. Compositionality 4(3) (2022). arXiv:2101.09363
Baez, J.C., Li, X., Libkind, S., Osgood, n.d., Patterson, E.: Compositional modeling with stock and flow diagrams. To appear in Applied Category Theory 2022, Electronic Proceedings of Theoretical Computer Science (2022). arXiv:2205.08373
ECMA-404: The JSON data interchange standard. https://www.json.org/json-en.html
Fong, B.: Decorated cospans. Theor. Appl. Categ. 30(33), 1096–1120 (2015). arXiv:1502.00872
Fong, B.: The Algebra of Open and Interconnected Systems. Ph.D. Thesis, Computer Science Department, University of Oxford (2016). arXiv:1609.05382
Fong, B., Spivak, D.I.: Hypergraph categories (2018). arXiv:1305.0297
Fong, B., Spivak, D.I.: An Invitation to Applied Category Theory: Seven Sketches in Compositionality. Cambridge University Press, Cambridge (2019)
Gelb, A.: Applied Optimal Estimation. MIT Press, Cambridge (1974)
Hart, G.W.: Multidimensional Analysis: Algebras and Systems for Science and Engineering. Springer, Berlin (1995)
Hovmand, P.S.: Community Based System Dynamics. Springer, Berlin (2014)
Lawvere, F.W.: Functorial semantics of algebraic theories. Proc. Natl. Acad. Sci. 50(5), 869–872 (1963)
Leinster, T.: Basic Category Theory. Cambridge University Press, Cambridge (2014). arXiv:1612.09375
Li, X., Doroshenko, A., Osgood, n.d.: Applying particle filtering in both aggregated and age-structured population compartmental models of pre-vaccination measles. PLoS ONE 13, e0206529 (2018)
Li, X., Keeler, B., Zahan, R., Duan, L., Safarishahrbijari, A., Goertzen, J., Tian, Y., Liu, J., Osgood, n.d.: Illuminating the hidden elements and future evolution of opioid abuse using dynamic modeling, big data and particle Markov chain Monte Carlo (2018)
Libkind, S., Baas, A., Halter, M., Patterson, E., Fairbanks, J.: An algebraic framework for structured epidemic modeling. Philos. Trans. R. Soc. A. 380(2233), 20210309 (2022). arXiv:2203.16345
Libkind, S., Baas, A., Patterson, E., Fairbanks, J.: Operadic modeling of dynamical systems: mathematics and computation. EPTCS 372, 192–206 (2022). arXiv:2105.12282
Meadows, N.: Hierarchical composition of stock & flow models. CEPHIL Technical Report (2022)
Osgood, N.: Representing progression and interactions of comorbidities in aggregate and individual-based systems models. In: Proceedings of the 27th International Conference of the System Dynamics Society. Albuquerque, New Mexico (2009)
Osgood, n.d., Eng, J.: Effective use of pmcmc for daily epidemiological monitoring and reporting: methodological lessons. Abstract & Conf. Publication, Ann. Meet. of the Statistical Society of Canada (2022)
Osgood, n.d., Liu, J.: Towards closed loop modeling: Evaluating the prospects for creating recurrently regrounded aggregate simulation models using particle filtering. In: Proceedings of the 2014 Winter Simulation Conference, WSC ’14, pp. 829–841. IEEE Press, Piscataway (2014)
Patterson, E., Lynch, O., Fairbanks, J.: Categorical data structures for technical computing. Compositionality 4(2) (2022). https://doi.org/10.32408/compositionality-4-5
Qian, W., Osgood, n.d., Stanley, K.G.: Integrating epidemiological modeling and surveillance data feeds: a Kalman filter based approach. In: International Conference on Social Computing, Behavioral-Cultural Modeling, and Prediction, pp. 145–152. Springer, Berlin (2014). https://doi.org/10.1007/978-3-319-05579-4_18
Safarishahrbijari, A., Teyhouee, A., Waldner, C., Liu, J., Osgood, n.d.: Predictive accuracy of particle filtering in dynamic models supporting outbreak projections. BMC Infect. Dis. 17(1), 1–12 (2017)
Spivak, D.I.: The operad of wiring diagrams: formalizing a graphical language for databases, recursion, and plug-and-play circuits (2013). arXiv:1305.0297
Spivak, D.I.: Category Theory for the Sciences. MIT Press, Cambridge (2014). Preliminary version. arXiv:1302.6946
Sterman, J.D.: Business Dynamics. McGraw-Hill, New York (2000)
Stockflow.jl. https://github.com/AlgebraicJulia/StockFlow.jl
Acknowledgements
We gratefully acknowledge the extensive insights, comments, and feedback from Evan Patterson of the Topos Institute. Co-author Osgood wishes to express his appreciation of support via NSERC via the Discovery Grants program (RGPIN 2017-04647), from the Mathematics for Public Health Network, and from SYK & XZO.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this chapter
Cite this chapter
Baez, J.C., Li, X., Libkind, S., Osgood, N.D., Redekopp, E. (2023). A Categorical Framework for Modeling with Stock and Flow Diagrams. In: David, J., Wu, J. (eds) Mathematics of Public Health. Fields Institute Communications, vol 88. Springer, Cham. https://doi.org/10.1007/978-3-031-40805-2_8
Download citation
DOI: https://doi.org/10.1007/978-3-031-40805-2_8
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-40804-5
Online ISBN: 978-3-031-40805-2
eBook Packages: Mathematics and StatisticsMathematics and Statistics (R0)