Further On A Clockwork Contagion


When last we spoke[1], I told you of my fellow students' and my first attempt at employing Professor B------'s wondrous computational engine[2] to investigate the statistical properties of the spread of disease; a subject that we had become most curious about whilst confined to our quarters during the epidemic earlier this year. You will no doubt recall that our model assumed that once someone became infected their infectiousness would persist indefinitely, which is quite contrary to the nature of the outbreak. We have since added incubation, recovery and immunity and it is upon these refinements that I shall now report.

A Second Model Of Infections

To model incubation and recovery we must keep a record of when, not just if, each individual succumbs to infection. To this end, deck 1 stores that day of infection in the pop array and uses the susceptible and infectious functions to determine the possible outcomes of interactions between people.

Deck 1: Total Infected By Day

Once again, we are assuming \(k\) interactions initiated at random by each member of a population of \(n\), a probability \(p\) of transmission from an infectious to a susceptible individual, further adding an incubation period of \(n_{inc}\) and an infectious period of \(n_{inf}\). Note that, since the window for spreading the disease is now finite, we have quadrupled the probability in order to increase the likelihood that an outbreak will nevertheless take hold, although it is by no means a certainty.
Furthermore, deck 2 records the daily number of novel infections arising within this model.

Deck 2: Newly Infected By Day

The number of folk who become infected upon a particular day is governed by the same process as that of our first model. Specifically, if there are \(i\) infectious people then the number of times an uninfected individual approaches one of them \(K^\rightarrow\) is binomially distributed with a probability mass function, or PMF, of
\[ \Pr\left(K^\rightarrow = k^\rightarrow\right) = p_{k,\frac{i}{n-1}}\left(k^\rightarrow\right) = \begin{cases} {}^k C_{k^\rightarrow} \times \left(\frac{i}{n-1}\right)^{k^\rightarrow} \times \left(\frac{n-1-i}{n-1}\right)^{k-k^\rightarrow} & 0 \leqslant k^\rightarrow \leqslant k\\ 0 & \text{otherwise} \end{cases} \]
where \({}^n C_r\) is the combination of \(r\) from \(n\) items, as is the number of times \(K^\leftarrow\) that they are approached by an infectious person, having the PMF
\[ \Pr\left(K^\leftarrow = k^\leftarrow\right) = p_{i \times k,\frac{1}{n-1}}\left(k^\leftarrow\right) = \begin{cases} {}^{i \times k} C_{k^\leftarrow} \times \left(\frac{1}{n-1}\right)^{k^\leftarrow} \times \left(\frac{n-2}{n-1}\right)^{i \times k - k^\leftarrow} & 0 \leqslant k^\leftarrow \leqslant i \times k\\ 0 & \text{otherwise} \end{cases} \]
The distribution of the number of contacts \(K^\leftrightarrow\) with somebody infectious may be recovered with the convolution
\[ \Pr\left(K^\leftrightarrow = k^\leftrightarrow\right) = p^\leftrightarrow\left(k^\leftrightarrow\right) = \sum_{k^\rightarrow=0}^k p_{k,\frac{i}{n-1}}\left(k^\rightarrow\right) \times p_{i \times k,\frac{1}{n-1}}\left(k^\leftrightarrow-k^\rightarrow\right) \]
where \(\sum\) is the summation sign, and the probability that they become infected is consequently
\[ p^+ = 1 - \sum_{k^\leftrightarrow=0}^{i \times k + k} p^\leftrightarrow\left(k^\leftrightarrow\right) \times (1-p)^{k^\leftrightarrow} \]
Finally, if the number susceptible to infection is \(u\) then the number of new infections \(K^+\) is distributed as
\[ \Pr\left(K^+ = k^+\right) = p_{u,p^+}\left(k^+\right) = \begin{cases} {}^{u} C_{k^+} \times {p^+}^{k^+} \times \left(1-p^+\right)^{u-k^+} & 0 \leqslant k^+ \leqslant u\\ 0 & \text{otherwise} \end{cases} \]
In order to figure the numbers in incubation and infectiousness we need to keep track of the historical numbers of novel infections which we can do by indexing \(i\), \(u\) and \(K^+\) by the time of observation \(t\) to yield rules for updating them
\[ \begin{align*} i_{t+1} &= i_t + K^+_{t+1-n_{inc}} - K^+_{t+1-n_{inc}-n_{inf}}\\ u_{t+1} &= u_t - K^+_t \end{align*} \]
as used in deck 3 to model infections with binomially distributed random variables.

Deck 3: Binomial Infections

Once again, having run decks 2 and 3 numerous times, my fellow students and I are confident that our two treatments of this model are equivalent, including the occasional failure of contagion to materialise.

A First Order Approximation

Expressing the numbers of infectious and susceptible members of the population as a proportion of its size
\[ \begin{align*} r^i_t &= \frac{i_t}{n}\\ r^u_t &= \frac{u_t}{n} \end{align*} \]
we have the rules of their evolution
\[ \begin{align*} r^i_{t+1} &= \frac{i_{t+1}}{n} = \frac{i_t}{n} + \frac{K^+_{t+1-n_{inc}}}{n} - \frac{K^+_{t+1-n_{inc}-n_{inf}}}{n} = r^i_t + \frac{K^+_{t+1-n_{inc}}}{n} - \frac{K^+_{t+1-n_{inc}-n_{inf}}}{n}\\ r^u_{t+1} &= \frac{u_{t+1}}{n} = \frac{u_t}{n} - \frac{K^+_t}{n} = r^u_t - \frac{K^+_t}{n} \end{align*} \]
and consequently
\[ \begin{align*} \Delta r^i_t &= r^i_{t+1} - r^i_t = \frac{K^+_{t+1-n_{inc}}}{n} - \frac{K^+_{t+1-n_{inc}-n_{inf}}}{n}\\ \Delta r^u_t &= r^u_{t+1} - r^u_t = - \frac{K^+_t}{n} \end{align*} \]
We then proceeded to simplify our model by putting the entirety of the masses of its random variables at their means, following much the same line of reasoning as we did for our first model. Specifically, given
\[ \begin{align*} K &\sim Binom(n, p)\\ E[K] &= n \times p \end{align*} \]
where \(E[K]\) is the expected value of \(K\), we recover the approximate expected number of infectious people that that a susceptible individual will encounter during the day with
\[ E[K^\leftrightarrow] = k \times \frac{i}{n-1} + i \times k \times \frac{1}{n-1} = \frac{2 \times i \times k}{n-1} \approx 2 \times k \times r^i \]
and the probability that they will become infected is therefore
\[ p^+ \approx 1 - (1-p)^{2 \times k \times r^i} \]
Noting that the total number of novel infections is itself binomially distributed and defining
\[ \hat{p} = (1-p)^{2 \times k} \]
the expected proportion of the population that are newly infected is given by
\[ E\left[\frac{K^+}{n}\right] = \frac{u \times p^+}{n} \approx r^u \times \left(1 - \hat{p}^{r^i}\right) \]
and consequently
\[ \begin{align*} E\left[\Delta r^i_t\right] &\approx r^u_{t+1-n_{inc}} \times \left(1 - \hat{p}^{r^i_{t+1-n_{inc}}}\right) - r^u_{t+1-n_{inc}-n_{inf}} \times \left(1 - \hat{p}^{r^i_{t+1-n_{inc}-n_{inf}}}\right)\\ E\left[\Delta r^u_t\right] &\approx -r^u_t \times \left(1 - \hat{p}^{r^i_t}\right) \end{align*} \]
We put together deck 4 to track the daily number of infections implied by this approximation, recording the numbers of people infected during each of the previous \(n_{inc}+n_{inf}\) days in the kt array to facilitate the reckoning of the number of individuals passing from incubation to infectiousness and from infectiousness to recovery upon the current day.

Deck 4: The First Order Approximation

Clearly this bears a close resemblance to typical results from our explicit simulations, as was the case for our first model, once again giving us some faith that a first order approximation is reasonable. Furthermore, it reveals a slightly more pronounced lack of symmetry than that of our first model.
The reason for this is twofold. Firstly, once individuals have recovered they can neither contract nor pass on the infection and so the infectious population decreases in magnitude relatively rapidly once the peak has been reached. Secondly, nor can those who are incubating the disease who consequently act as a temporary buffer between the infectious and the susceptible, slowing the initial rate of infection.
We assembled deck 5 to explore the consequences of ever shorter lengths of infectiousness and I must confess that we were rather surprised at its results!

Deck 5: The Effect Of Infectiousness

To gain further insight into our model's potentially oscillatory behaviour, we constructed deck 6 which instead varies the length of incubation.

Deck 6: The Effect Of Incubation

In both decks we observe oscillation when the length of incubation is greater than the length of infectiousness which, after some thought, led my fellow students and me to conclude that it is a consequence of overlapping periods of infection.
For example, in the final step of deck 6 the period of infectiousness is seven days and that of incubation is fourteen and so the first case will infect people on days zero to six. Each of those that were infected on day \(i\) will be infectious from days \(14+i\) to \(20+i\) and we should therefore see an almost bell-shaped distribution of infections from days fourteen to twenty six, peaking at day twenty. The number of overlapping periods of infectiousness from each generation of infection will increase over time but the distribution of their resulting infections will take similar forms. If the incubation period is long enough when measured against the infectiousness period then these generations will not completely merge into one another before the outbreak has concluded and we should expect to find such oscillatory rates of infection.

Of course my fellow students and I were still most interested in the effect of minimising interactions between people upon rates of infection owing to our being ordered to remain within our halls of residence during the contagion. To that end we put together deck 7 which charts the rates implied by our model for decreasing numbers of contact initiated by each member of the population upon each day.

Deck 7: The Effect Of Contacts

This exhibits similar general behaviour to that we found with our previous model; the reduction in contact reduces the peak infection rate whilst postponing its arrival, lending support to the Dean's confinement edict. An interesting difference is that it makes the asymmetry most evident when the number of contacts is at its greatest by implying a small peak of initial infections before the outbreak takes hold.

In the light of Dr J-----'s recent discovery that those who are exposed to variolæ vaccinæ are frequently gifted immunity to smallpox, we were naturally curious as to how effective deliberate infection of the population with a bovine variant of the disease, should we have been fortunate enough to have chanced upon one, might have been in arresting the outbreak. Deck 8 models such inoculation by progressively reducing the number of individuals who are susceptible to infection at the outbreak of the epidemic.

Deck 8: The Effect Of Immunity

Clearly this is far more effective than isolation! Oh, that we should have had such good fortune!

Deviations From The Mean

We should like to have some notion of the uncertainty in these results and so noting that, since the variance of a binomial distribution with \(n\) trials and a probability \(p\) of success is \(n \times p \times (1-p)\), the variances in the rates of infection implied by our model are given by
\[ \begin{align*} E\left[\left(\frac{K^+}{n} - E\left[\frac{K^+}{n}\right]\right)^2\right] &= \frac{E\left[\left(K^+ - E\left[K^+\right]\right)^{\,2}\right]}{n^2} \approx \frac{\left(n \times r_u\right) \times \left(1 - \hat{p}^{r^i}\right) \times \hat{p}^{r^i}}{n^2}\\ &= \frac{r_u}{n} \times \left(1 - \hat{p}^{r^i}\right) \times \hat{p}^{r^i} \end{align*} \]
we compiled deck 9 to chart the daily rates of infection for values of \(K^+\) that are ever put above and below their mean by one standard deviation as the number of contacts initiated by each individual decreases, with the former drawn in green and the latter in red.

Deck 9: Cumulative Deviations For Reducing Contacts

This is very much in line with the result of our prototypical model in that minimising interactions both reduces the rate of infection and increases the uncertainty of when its peak will occur.

Our final question was whether inoculation should have produced similar uncertainty and so we put together deck 10 to track the rates of infection for increasing rates of immunity as \(K^+\) is again set above and below its mean by one standard deviation.

Deck 10: Cumulative Deviations For Increasing Immunity

If our model is in any way reflective of the true nature of contagion then not only is inoculation more effective than isolation, its consequences are significantly less uncertain!


[1] On A Clockwork Contagion, www.thusspakeak.com, 2021.

[2] On An Age Of Wonders, www.thusspakeak.com, 2014.

Leave a comment

This site requires HTML5, CSS 2.1 and JavaScript 5 and has been tested with

Chrome Chrome 26+
Firefox Firefox 20+
Internet Explorer Internet Explorer 9+