With the COVID-19 pandemic keeping me inside, I thought I would create some simulations to explore some dynamics in epidemiology.
The first model idealizes a disease like measles, mumps or rubella, in which people who have recovered from it maintain immunity for the rest of their life.
Let \$S\$ be a real number in the range \$\[0,1]\$ representing the proportion of the population that is susceptible to the disease. They are healthy and have no immunity against the disease. In this model, we will assume that all people in the population are equally likely to get the disease and none of them are immune to it.
Let \$I\$ be a real number in the range \$\[0, 1]\$ representing the propotion of the population that is currently infected with the disease.
Let \$R\$ be a real number in the range \$\[0, 1]\$ representing the proportion of the population that has recovered from the disease. These people are no lnger contagious, meaning they can no longer get anyone else sick, and they are immune to the disease, so they can’t get it again.
The the rates at which people transition from susceptible (\$S\$) to infected (\$I\$) to recovered (\$R\$) is described by the following equations:
where \$S + I + R = 1\$.
In this analysis, we will start by assuming that \$\beta\$ and \$\gamma\$ are constant. Note that \$\beta\$ and \$\gamma\$ have dimension of inverse time. So \$\beta\$ can be thought of as the rate at which infected people infect susceptible people, and \$\gamma\$ as the rate at which infected people recover.
The basic dynamics of the S-I-R model are easy to understand. Imagine a population shortly after the introduction of a new disease where at time \$t = 0\$, \$1\%\$ of the population has been infected and \$99\%\$ are still susceptible.
Since the rate of infection is proportional to the number of suscteptible people and the number of infected people, the number of infected people increases itself at an increasing rate. As people recover and become immune, the numbers both of infected and susceptible people are reduced, and therefore the rate of new infections that appear also begins to shrink.
How quick the spread and how many people get infected depend on the values of both \$\beta\$ and \$\gamma\$. If it clear that if \$\gamma < \beta\$, there will not be a pandemic, because the number of infections will immediately begin shrinking. To illustrate this, first consider the horrible case where \$\gamma = 0\$ so we can see what happens when nobody recovers.
Figure 1 shows the dynamic where \$\beta = 0.05\$ and \$\gamma = 0.00\$. Since nobody ever recovers, the rate of increase of infected people is identical to the rate of decrease of the number of susceptible people. Both follow a logistic curve.
Figure 2 shows the dynamic for \$\beta = 0.04\$ and \$\gamma = 0.01\$. The portion of the population with the infection increases early on and then levels out after 180 days. At day 180, \$42\%\$ of the population has the disease. At this point, with more people recovering and becoming immune, the rate at which new recoveries occur becomes greater than the rate at which new infection occur. After more than a year, almost everyone in the population will have been infected at some point.
Figure 3 shows the dynamic for \$\beta = 0.08\$ and \$\gamma = 0.04\$. This time the portion of simultaneously infected people peaks earlier after about 100 days, with \$17 \%\$ of the population sick at the same time. In the limit, about \$80 \%\$ of the population will have been infected at some point.
At this point it should be pretty clear, both from mathematical analysis of the equations, and from a superficial analysis of the individual simulations in cases 0 through 2, that the \$\beta\$ and \$\gamma\$ control:
-
the portion of the population that becomes sick simultaneously; and
-
the portion of the population the gets sick eventually;
-
the duration of the pandemic.
The the sections that follow, we compare the effects of different \$\beta\$ and \$\gamma\$ on these key measures.
During news coverage on COVID-19, there has been lots of talk about "flattening the curve". Remembering that the only purpose of this document is to use a very simplistic model as a toy to demonstrate how to create reproducible simulations and analyses, not as an attempt to make any recommendations about or even provide insight into the present pandemic, it is nonetheless clear why we should want to look at the portion of the population who become infected at the same time. Too many simultaneous infections puts an excessive load on the systems that care for the infected people who fall ill.
Simulations were run for every combination of \$\beta\$ in \${0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09}\$ and \$\gamma\$ in \${0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08. 0.09}\$. For each combination, the maximum value of \$I\$ is reported in Figure 4.
For all cases when \$\gamma\$ is less than \$\beta\$, the maximum value is \$0.01\$, or 1%. This is because the portion of infections was started at \$I = 0\$, and immediately began to decrease. The approximate trend is that as the ratio \$\beta / \gamma\$ increases, so does the number of simultaneous infections. Interestingly, different \$\beta\$ and \$\gamma\$ still have similar values for the peak. For example, for \$\beta = 0.02\$ and \$\gamma = 0.01\$, the peak is 16%, and for \$\beta = 0.04\$ and \$\gamma = 0.02\$, the peaks is also 16%.
There is also the question of how many people must become infected to achieve "herd immunity". Will everyone get sick? Or how many will be spared of the illness once enough have recovered and developed immunity?
From the same simulations in the previous section, we can measure the total number of people having been infected. These are shown in Figure 5. Perhaps unsurprisingly, the relationship is similar.