Kermack-McKendrick SIR Model

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

The Kermack–McKendrick susceptible/infected/removed (SIR) model is one of the simplest possible descriptions of a viral outbreak [1]. After normalizing variables, it depends on only one shape parameter, which determines skew-asymmetry of the distribution of infected individuals across time. Any simpler logistic model of [2] cannot account for asymmetry, unless the differential equation is solved by an error-prone application of Euler's method [3]. This Demonstration shows that erroneous solution of the logistic equation produces a 99.9% accurate, discrete solution of the SIR differential equations over a limited range of the parameter space (see Details). These are called "logistic peaks".

Contributed by: Brad Klee (April 2020)
Open content licensed under CC BY-NC-SA



The Kermack–McKendrick model is a set of three differential equations:




which together preserve the total population count, . The third equation is not necessary, and the first two are simplified by dividing out the constant , that is, transforming for all . Furthermore, the first equation entails a logarithmic derivative, so , which simplifies the second equation to read


This form has only one dependent and one independent variable, but it is not an ordinary differential equation. A more simple alternative is the logistic equation


Population count is a sigmoid similar to , so compares naturally to . A discrete approximation to can be found by Euler's method,


and subsequently,


According to the overshoot error of Euler's method, turns out to have asymmetry comparable to when, say, . Over this range, a cubic function,


does a satisfactory job of converting , with . Using this function (and adjusting scale parameters as necessary) a 99.9% accurate, discrete solution of the SIR equations is achieved (see the source code for more details).

This range of solutions gives one answer to the question: how do the SIR equations relate to the logistic equation? For the range of valid parameters, the identity between logistic and SIR solutions allows an SIR-compliant fit function to be computed via the simpler logistic iteration. There is an argument that discrete fit functions are less useful than their continuous counterparts. We have recently shown in another Demonstration [4] that this argument is not too serious. When data has significant variance, it often needs to be binned. Fitting by discrete or continuous functions then produces relatively similar results. The discrete method may even be preferable because it is computationally fast.


[1] E. W. Weisstein. "Kermack–McKendrick Model" from Wolfram MathWorld—A Wolfram Web Resource. (Apr 27, 2020) (Wolfram MathWorld).

[2] E. W. Weisstein. "Logistic Equation" from Wolfram MathWorld—A Wolfram Web Resource. (Apr 27, 2020) (Wolfram MathWorld).

[3] E. W. Weisstein. "Logistic Map--r=2" from Wolfram MathWorld—A Wolfram Web Resource. (Apr 27, 2020) (Wolfram MathWorld).

[4] B. Klee. "Summer Insect Pandemics in the United States" from the Wolfram Demonstrations Project—A Wolfram Web Resource. (Apr 27, 2020)

Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.