How infectious diseases spread
How infectious diseases spread
Thursday, 02 July 2009
Marcus du Sautoy’s recent column in The Times, “Sexy maths: Arithmetic eases swine flu worries”, got me thinking about modelling the spread of infectious diseases.
The Susceptible–Infectious–Recovered (SIR) Model was first explored in the 1920s and 30s by Kermack and McKendrick, who pioneered the use of mathematical methods in epidemiology. It is a simple three-compartment model described by three differential equations and a handful of parameters, crude but capable of generating several valuable insights. Ignoring the effect of births and deaths, the controlling equations are as follows.

where:
S = susceptible population
I = infected population
R = recovered population
P = S + I + R = total population
β = contact rate
γ = recovery rate = 1 / recovery time
R0 = β / γ = basic reproduction number
The model is non-linear and so not amenable to a general analytical solution. It is, however, easy to build a numerical solution in a spreadsheet. It is simpler than, but not unlike, the dynamic modelling I do for clients. Download my model and explore it for yourself.
All the numbers you might want to change, the starting populations and parameters for the differential equations, are on the Input sheet, in column J for the USA, K for the UK and L for the rest of the world. Select the geography you are interested in by entering in cell H26: 1 for the USA, 2 for the UK and 3 for RoW. The differential equations are integrated with a Runge-Kutta routine implemented in Visual Basic (press [Alt+F11] to take a look), so be sure to switch macros on.
The model includes data (on the Actual Sheet) for the number of confirmed cases of swine flu in the early days, before it was declared a pandemic and recording, at least in the UK, became a lot less rigorous. The data is charted on the Input sheet so you can see how well the model fits.

The critical variable governing the spread of an infectious disease is R0, the number of people a single contagious patient will infect in a population of susceptible people, over the duration of the infection. The higher the value, the further the infection will spread before it peters out. Not everyone will be infected, because those who recover are no longer susceptible to catching the disease again and they start to swamp the population and reduce the number of susceptible contacts available to an infected patient. Vaccination, of course, is a way of inducing this herd protection effect without people having to go through having the disease.
In the early days, before the pool of recovered patients gets too large, the growth of the number of cases (infected plus recovered) is almost exponential, which is a straight line on the log scale of the graph on the Input sheet. What’s interesting is that the number of cases grows very rapidly in all three geographies in the first 2–3 weeks, and then slows to a lower growth rate. The initial growth, presumably, comes from travellers to Mexico returning home, ie, these are infections generated “outside” the model. Then, once infection control measures start to have an effect the rate of growth slows to a more natural level.
More interesting is the fact that growth in the UK continues at a higher rate than elsewhere. Assuming a common recovery time of seven days, R0 in the USA appears to be 1.28, in the RoW 1.40 and in the UK 1.73. The difference means that, by the time the pandemic has passed, 34% of the population will have been infected in the USA, whilst 70% will succumb in the UK. Should I, as a Brit, be concerned about the apparent lack of effectiveness in the UK’s pandemic response?
The model is very simple, and I hope the planners are using something a little more sophisticated. R0 might well change as disease control procedures change, or schoolchildren disperse for the summer. So a better model needs to have parameters that change over time. Nevertheless, I am pleased with how much I learned from an afternoon’s programming.
See also:
- Sexy maths: Arithmetic eases swine flu worries, by Marcus du Sautoy
- The mathematics of diseases, a very readable article from Plus, part of Cambridge U’s Millennium Mathematics Project
- SIR model on Wikipedia
- Swine flu: Country by country, an animated map on the BBC News website showing the spread of the disease over time.

