# Further Still On A Clockwork Contagion

My fellow students and I have spent the past several months attempting to build a mathematical model of the spread of disease, our interest in the subject having been piqued whilst we were confined to our halls of residence during the epidemic that beset us upon the dawn of the year. Having commenced with the assumption that those who became infected would be infectious immediately and in perpetuity we refined our model by adding a non-infectious period of incubation and a finite period of illness, after which sufferers should recover with consequent immunity and absence of infectiousness.
A fundamental weakness in our model that we have lately sought to address is the presumption that individuals might initiate contact with other members of the population entirely by chance when it is far more likely that they should interact with those in their immediate vicinity. It is upon our first attempt at correcting this deficiency that I should now like to report.

### A Third Model Of Infections

To factor for the notion of distance, my fellow students and I first added a random standard uniformly distributed two dimensional vector location to each and every member of the population. Having done so we replaced the wholly random individually initiated interactions with a scheme that favours approaching those who are geographically proximate. Specifically, we defined a function that took its greatest values for distinct individuals that resided nearby to one another
$w(i, j) = \begin{cases} e^{-c \times \left|\mathbf{x}_i - \mathbf{x}_j\right|^2} & i \neq j\\ 0 & \text{otherwise} \end{cases}$
where $$\mathbf{x}_i$$ is the location of the $$i^\mathrm{th}$$ member of the population and the vertical bars stand for the length of the vector that they enclose, in this case being equal to the distance between those whose difference has been taken. Taking a random fraction of its total across the population for a given $$j$$
\begin{align*} u &\sim U(0,1)\\ s_j &= u \times \sum_{i=0}^{n-1} w(i, j) \end{align*}
where $$\sum$$ is the summation sign and $$n$$ is the size of the population, then the smallest index $$i^\prime$$ that satisfies
$\sum_{i^\prime=0}^{n-1} w\left(i^\prime, j\right) > s_j$
is not an unreasonable way to make a choice that will likely be close to it.

To try out this scheme my fellow students and I put together deck 1 which plots the number of infections that have occurred by day, pre-reckoning the weights for each individual, together with their totals, and searches for the requisite $$i^\prime$$ by iteratively subtracting the former from a fraction of the latter, assuming $$k$$ initiated contacts per person per day, a probability $$p$$ that an infectious person will transmit the disease and periods $$n_{inc}$$ and $$n_{inf}$$ of incubation and infectiousness.

Deck 1: Total Infected By Day Note that figuring the weights rather pushed Professor B------'s engine to its limits and so we were left with little choice but to reduce the population by a factor of ten!

We subsequently assembled deck 2 to to reckon the differences between those figures upon consecutive days, yielding the volumes of newly infected.

Deck 2: Newly Infected By Day Most notably this does not follow the relatively clear bell-shaped curve exhibited by our previous models, often appearing almost triangular in aspect and frequently dramatically skewed to the right at that! To get some inkling as to why this might be so, we compiled deck 3 as a simulacrum of the geographical propagation of the infection.

Deck 3: The Geography Of Infection Here we find that there are initially small clusters of infection that rapidly coalesce into a radial wave of contagion. If that wave emanates from a corner then it progresses almost diagonally, from narrow to wide to narrow again, giving cause to the frequent near triangular evolution of the daily rates of infection upon account of the length of the hypotenuse $$h$$ of a right-angled triangle whose other sides are in proportion to some particular length $$x$$ being linearly dependent upon it
\begin{align*} h^2 &= (a \times x)^2 + (b \times x)^2 = a^2 \times x^2 + b^2 \times x^2 = \left(a^2 + b^2\right) \times x^2\\ h &= \sqrt{a^2+b^2} \times x \end{align*}

### A Tale Of Several Villages

We were, of course, still operating from the flawed premise that the population should be evenly settled upon the land. To rectify this we contrived to concentrate them in roughly circular clusters, using a bivariate normally distributed random variable to figure each person's habitation's distance from one of some several randomly chosen village centres and deck 4 charts the progression of infection given this new assumption.

Deck 4: The Spread Through Villages We typically see a rapid spread of disease in the first village and, after some delay, the infection takes hold in another then another until the entire population eventually contracts it. However, if you run the deck several times you will find that it is possible for outlying villages to escape infection entirely. Should a village have no symptomatic residents then its council would be well advised to close its gates until the epidemic subsides but as soon as any of them fall ill it would very unlikely make any difference.
Since the progress of infection now typically occurs in fits and starts, its rate is most frequently multimodal, having more than one peak, as demonstrated by deck 5.

Deck 5: The Multimodal Rate Whilst premise of this model is certainly more reasonable than those of our previous models, it is beyond our wits to derive a simple mathematical formula that describes its behaviour. My fellow students and I therefore decided to simplify our assumptions once again, hoping to retain elements of that behaviour so that we might gain some insight into it.

### A Fourth Model Of Infections

Specifically, instead of weighting the probabilities of interaction by distance we again assumed that they would occur evenly, albeit predominantly within a village. To this end we assumed that equally populous villages were arranged in a circle and defined a probability $$p_x$$ that an interaction would be with a uniformly random member of an adjacent village, as opposed to a uniformly random member of the same village.
Denoting the number of village residents with $$n_1$$ and the number of villages with $$n_2$$, we put together deck 6 to examine the consequences of this assumption.

Deck 6: The Ring Of Villages We were most satisfied to observe that this exhibits similar behaviour to our more sophisticated model of the spread of disease from village to village. Furthermore, its not requiring the reckoning of weights significantly reduced the burden upon the calculating engine and we were consequently able to restore the magnitude of the population as a whole when figuring its daily rate of infection in deck 7.

Deck 7: The Simplified Rate Of Infection A far greater advantage of this simplification, however, is that it is amenable to mathematical analysis!

Defining $$K_{v,t}^\rightarrow$$ as the number of contacts a member of the $$v^\mathrm{th}$$ village initiates with infectious people upon the $$t^\mathrm{th}$$ day, we have
$E\left[K_{v,t}^\rightarrow\right] = k \times \left(\left(1-p_x\right) \times \frac{i_{v,t}}{n_1-1} + p_x \times \frac{i_{v^-,t}+i_{v^+,t}}{2 \times n_1}\right)$
where $$E$$ stands for the expected value of the term between the following square brackets, $$v^-$$ is the clockwise neighbouring village and $$v^+$$ is the anticlockwise, and $$i_{v,t}$$ is the number of the infectious for the subscripted village and day. This follows from the fact that they have a $$1-p_x$$ chance of doing so within their own village, which has $$n_1-1$$ other residents, and a $$p_x$$ chance of doing so in one of the two neighbouring villages, which have $$2 \times n_1$$ residents in total.
Similarly defining $$K_{v,t}^\rightarrow$$ as the number of infectious people who initiate a contact with a single member of a village during the passage of a day, we have
$E\left[K_{v,t}^\leftarrow\right] = i_{v,t} \times k \times \left(1-p_x\right) \times \frac{1}{n_1-1} + \left(i_{v^-,t}+i_{v^+,t}\right) \times k \times p_x \times \frac12 \times \frac{1}{n_1}$
where the factor of one half in the second term arises from the fact that members of a neighbouring village may venture out to their other neighbouring village.
The expected total number of infectious contacts $$K^\leftrightarrow_{v,t}$$ is consequently
$E\left[K_{v,t}^\leftrightarrow\right] = E\left[K_{v,t}^\rightarrow\right]+E\left[K_{v,t}^\leftarrow\right] = \left(1-p_x\right) \times \frac{2 \times i_{v,t} \times k}{n_1-1} + p_x \times \frac{\left(i_{v^-,t}+i_{v^+,t}\right) \times k}{n_1}$
and we may approximate the probability of infection $$p^+_{v,t}$$ with
$p_{v,t}^+ \approx p^\prime_{v,t} = 1 - (1-p)^{E\left[K_{v,t}^\leftrightarrow\right]}$
Given $$u_{v,t}$$ susceptible villagers, the number $$K^+_{v,t}$$ that will become infected during the day is binomially distributed with $$u_{v,t}$$ experiments having a $$p^+_{v,t}$$ chance of success
$K^+_{v,t} \sim Binom\left(u_{v,t}, p^+_{v,t}\right)$
where $$\sim$$ means drawn from. Our model approximates it with
$K^\prime_{v,t} \sim Binom\left(u_{v,t}, p^\prime_{v,t}\right)$
and my fellow students and I assembled deck 8 to make random observation of its infection rates.

Deck 8: Binomial Infections Being satisfied that its results and those of the full simulation are at least of a kind, we resolved to investigate its likeliest outcomes.

### Typical Behaviour

Noting that
\begin{align*} K &\sim Binom(n, p)\\ \mu_K &= E[K] = n \times p\\ \sigma^2_K &= E\left[\left(K-E[K]\right)^2\right] = n \times p \times (1-p) \end{align*}
where $$\mu$$ stands for the mean and $$\sigma^2$$ for the variance, we compiled deck 9 to follow the spread of infection should every village acquire its mean number of daily infections.

Deck 9: Following The Averages Once again we were keen to examine the consequences of reducing the number of contacts initiated each day by the villages and we put together deck 10 to chart the daily number of infections as we do so.

Deck 10: The Effect Of Contacts That the peaks flatten as the number of contacts decrease is unsurprising, being very much in line with our previous models. As we had done for them, we consistently put $$K^\prime_{v,t}$$ both one standard deviation above and below its mean to measure the variability in the rates of infection, as shown by deck 11.

Deck 11: Cumulative Deviations For Contacts Clearly the uncertainty in the arrival of the peak rates of infection that we had observed in our more primitive models persists. The obvious question is whether we should find similar results for decreasing probabilities of cross-village interactions and so we assembled deck 12 to observe the implications of holding $$K^\prime_{v,t}$$ at its mean as they shrink.

Deck 12: The Effect Of Excursions In these circumstances the daily infection rates proceed from something very much like our former models to the multimodal curves that we have seen are a consequence of clustered populations, which is quite understandable given that high values of $$p_x$$ imply that infection will spread between villages extremely rapidly. Our final question was what effect should this have upon the uncertainty regarding the occurrence of the peaks in the infection rate and we built deck 13 to answer it.

Deck 13: Cumulative Deviations For Excursions I must confess that I was somewhat surprised that this didn't have the same effect as reducing the number of contacts, leaving the uncertainty more or less unmolested. In retrospect I hadn't any particular cause to expect otherwise; the principal difference between setting very large and very small values of $$p_x$$ being the size of the population exposed to infection.

Whilst there is yet more to consider regarding the matter of contagion, for the time being our studies must take precedence.
$$\Box$$

### References

 On A Clockwork Contagion, www.thusspakeak.com, 2021.

 Further On A Clockwork Contagion, www.thusspakeak.com, 2021.

 On An Age Of Wonders, www.thusspakeak.com, 2014.

### Gallimaufry  AKCalc
ECMA  Endarkenment
Turning Sixteen

• Subscribe
• Contact
• Downloads
• GitHub

This site requires HTML5, CSS 2.1 and JavaScript 5 and has been tested with Chrome 26+ Firefox 20+ Internet Explorer 9+