Scroll Top

Exploring Public Health Policy using the SIR STOCK and FLOW Model

“A model is just a simplification of the world, designed to help us understand what might happen in a given situation”

Adam Kucharski (The Rules of Contagion: Why Things Spread – and Why They Stop)

Infectious disease models have played an important role as part of the scientific evidence to guide the response to the COVID-19 pandemic. These models capture two important aspects of infectious disease transmission. First, they represent – based on medical knowledge – the different stages of disease progression, and how these stages are interlinked. Modellers often term this the model structure, where the population is sub-divided into different compartments, starting with people who are at risk of catching the disease (susceptibles), moving on to people who are infectious and can infect others, before transitioning to people in a recovered compartment, where they are immune from the virus.


The second feature of infectious diseases models is that they represent important parameters about the pathogen, and these parameters control the transitions between the different model compartments. A parameter is a value that is deemed important by experts, and is usually determined through data collection, or statistical analysis. For infectious disease models there are two main types of parameters. Biological parameters represent information on the disease itself, for example, (1) the duration of infectiousness (how long on average someone might shed the virus and infect others), and (2) the infectivity (the chance of an infectious person passing on the virus), where some viruses would have a higher infectivity than others (e.g. for SARS-CoV-2 the delta variant is up to 60% more infectious than earlier variants).

Spreading the virus requires social contact, and social contact parameters estimate the level of contacts in the population. Even in our digital age, measuring social contacts is a challenging task, and there are resources and information than can be used to inform levels of contacts in the population. These would include population surveys such as the POLYMOD study, the CoMix study in the UK, and tools such as socialmixr that allow modellers to use social contacts information in disease models. Mobility measures such as those published by Apple and Google can also be informative, as they provide signals of the levels of mixing in a population.


Compartmental models of infectious diseases are also known as stock and flow models, and the intuitive ideas underlying stocks and flows can help decision makers understand what might happen when a novel pathogen invades. A stock models an accumulation of something, for example a stock could represent the annual population of a city at a point in time. Stocks can only change through their flows, and a flow can either be an inflow (increases the stock), or an outflow (reduces the stock). The analogy of a bathtub is often used, where the bathtub represents a stock that accumulates its inflows (from the tap) minus its outflows (through the drain). In mathematical models, stocks and flows are represented as equations, and these equations can be solved using a spreadsheet, a programming language or special purpose software, in order to generate projections of a stock over time. Returning to our city example, a stock and flow equation (i.e. a mathematical model) for the city population is:

This stock equation, which is calculated for every time step in a model, informs us that the Population in January 2022 (the stock) is the addition of the Population in January 2021 (the previous stock) with Additions over the year (for example, births and people moving to the city), minus any Removals over the year (deaths and people migrating out of the city). Based on this equation, we can list three observations of how stock and flow systems behave:


  1. If the inflow is greater than the outflow, the stock will rise.
  2. If the outflow is greater than the inflow, the stock will fall.
  3. If the inflow equals the outflow the stock remains the same, and is in a state of what is known as dynamic equilibrium.


We can now apply this stock and flow thinking to infectious diseases using the classic SIR model. Recall a couple of things: the SIR (Susceptible-Infected-Recovered) represents: (1) the biological pathway of the disease (see the arrows in the diagram); and (2) the parameters (contacts, infectivity, duration of infectiousness) that determine how quickly people flow from stock to stock.

Each of the three stock equations are similar to the earlier city population equation, and here we focus here on the infectious stock, as that plays a key role in driving an epidemic.

In the model output table, we can see that the number of infectious at the start of day 20 (1,370) is the number infectious from day 19 (1,024), plus new infections during day 19 (788) minus those who recovered on day 19 (512).


The equations for the inflow and outflow are worth reflecting on, and we will manipulate these to explore some key insights for the model. The model’s inflow equation, Becoming Infected is a useful representation of how a disease transmits.

It can be explained as follows. Every infectious person (I) generates cI contacts per day. A proportion of those contacts are with susceptible people (S/N). Then, for each of these contacts there is a chance (i) that the contact leads to infection. Note that the model contains the possibility of amplification or positive feedback, because as people become infected the stock grows, and as the stock grows, more people become infected, and this drives exponential growth in disease cases.

People do not remain infectious indefinitely, and to model this, there is an outflow from the infectious stock. This outflow removes a proportion of the stock based on the biological parameter for the average duration of infectiousness, and this equation is a simple structure used to model delays in stock and flow systems.

Now we have equations for the inflow and the outflow, so we can return to the first principle of stock and flow systems: if the inflow is greater than the outflow, the stock will rise. This can be represented as an inequality between the inflow and the outflow.

The inequality can be further simplified to the following tipping point equation.

We call this a tipping point, because if the inflow exceeds the outflow, the infectious stock increases, and this will in turn leads to more infections and drive exponential growth. We can take each of the terms separately, and explore their potential impact on the tipping point, and also see how each variable relates to public health measures.

  • c represents average contacts per person per day. If contacts increase, so too does the LHS of the equation. The opposite is also true, reducing contacts reduces the pressure on the tipping point, and this response is often known as a non-pharmaceutical intervention (NPI).


  • i represents the chance of an infection spreading, given that there is contact between an infectious and susceptible person. This parameter can be used to model a number of circumstances that impact transmission, including: (1) the wearing of masks, which would reduce its value; (2) whether a new virus strain had emerged, which would increase its value; or, (3) if antivirals were available, which could reduce the viral load, and therefore diminish the chance of person-to-person transmission.


  • D represents the average duration that someone is infectious. While this is a biological parameter that would be estimated from medical data, in this SIR model is captures the amount of time someone is infectious and mixing with others. Therefore, if people were quarantined rapidly through a test trace and isolate process, this would effectively reduce the value of D in the model, and move the model away from a tipping point.


  • Finally, the term (S/N) represents the proportion of the population at risk of infection. This is 1 at the start of a pandemic, as everyone is susceptible to a novel pathogen. However, public health vaccination programs provide people with immunity, where they are no longer at susceptible or at risk. With successful vaccination the fraction (S/N) gets smaller, and the model moves further away from the tipping point.

In summary, while the SIR model is a simplification of how infectious diseases spread, viewing the infectious stock as an accumulation that changes through its inflow and outflow is a useful idea, as it can help focus on the types of public health interventions (non-pharmaceutical and non-pharmaceutical) that can help control an outbreak.


Jim Duggan, School of Computer Science, National University of Ireland Galway

Twitter @_jimduggan

Open Access Publications

Heesterbeek, H., Anderson, R.M., Andreasen, V., Bansal, S., De Angelis, D., Dye, C., Eames, K.T., Edmunds, W.J., Frost, S.D., Funk, S. and Hollingsworth, T.D., 2015. Modeling infectious disease dynamics in the complex landscape of global health. Science, 347(6227).

Blackwood, J.C. and Childs, L.M., 2018. An introduction to compartmental modeling for the budding infectious disease modeler. Letters in Biomathematics, 5(1), pp.195-221. Vancouver.

Duggan, Jim. (2016). An Introduction to System Dynamics Modeling with R (pp. 1-24). Cham: Springer International Publishing. DOI 10.1007/978-3-319-34043-2_1

Modelling Groups

Irish Epidemiological Modelling Advisory Group to NPHET. Includes technical notes, slides from the NPHET press briefings and IEMAG meeting minutes.

The Centre for Mathematical Modelling of Infectious Diseases. London School of Hygiene and Tropical Medicine. Twitter: @cmmid_lshtm

MRC Centre for Global Infectious Disease Analysis, Imperial College London. Twitter: @MRC_Outbreak

EPIcx Lab.  INSERM – Institut national de la santé et de la recherche médicale. Twitter: @vcolizza