Some people don’t have the means to fight diseases on their own, and cannot be protected against them either. Among these individuals, we find the elderly, infants, and people with weak immune systems.
In this article, we will make a model of a disease spreading in a population, and observe the effect of immune people on the spreading of the disease.
- This article does not aim to spark a discussion on vaccination. Although we will take the example of a disease spreading, the effect we will demonstrate – Herd Immunity – can be seen in all kinds of environments, for example drones spreading a computer virus to all drones nearby via bluetooth, or trees being attacked by invasive insects.
- The mathematical model we will build, although elaborate, is far from being perfect, and is not intended to be used to mathematically prove anything. The percentages are heavily dependent on the model, and cannot be used as references.
1. Modeling the population and disease
The model is rather straightforward, and rely on the following mechanics:
- Motion: All Individuals move randomly (random walk with momentum), but collide with each other. This models the fact that, in a crowd, you are not directly in contact with everyone, and need to go around obstacles to reach someone.
- Infection: Sick individuals have a probability to propagate the disease to other nearby individuals, not every encounter ends up with an infection.
- Incubation: The disease stays latent for some time before the individuals can spread it.
- Recovery: The disease is non fatal for normal individuals, and goes away after some time. During recovery, the individuals have a high probability of becoming immune to the disease.
- Death: Weak individuals don’t survive the disease.
*The code is linked at the end of the article
With these simple rules, we can study the evolution of the disease and how it spreads in the population. In this model, defenseless people are colored in gold. These are the ones we want to protect.
Note: Individuals are invisible (white) when healthy, dark teal when incubating and red when sick. Immune individuals are transparent gray-blue.
2. How the number of immune people impact the spreading of the disease
Now that we have a population, we need an outbreak. For that, we arbitrarily infect everyone that start it’s journey in the very center of the world. Everything that happens next is solely due to the movement of the individuals and the spreading of the disease.
Let’s look at what happens in our population when 10% of the individuals are immune to the disease.
Epidemic with 10% immunity rate.
As you can see, the epidemic quickly progresses to infect every possible individual. The weakest individuals being defenseless against it, none survive. This is the worst case scenario, which we want to avoid at all cost.
💡Idea: There is hope that with more immune individuals, the disease will spread more slowly and/or infect fewer people.
Let’s put this to the test: here is what would happen when more than half of the population – 55% – is immune to the disease.
Epidemic with 55% immunity rate.
This doesn’t make a lot of difference, does it? This is explained by the fact that, even though there are more immune people, the disease still manages to find a way to propagate. What about with an 80% immunity rate?
Epidemic with 80% immunity rate.
Now we are seeing some change! The disease is much slower to spread because there aren’t as many potential hosts as before. This helps buy time to find a cure, but isn’t enough to stop the epidemic. After a while, the disease has reached the whole population.
When we continue to increase the immunity rate, we notice a sudden drop in the mortality rate of the weakest individuals. Let’s take a look at what happens, here at 93% of immunity.
Epidemic with 93% immunity rate.
At this point, the disease cannot find enough viable hosts to survive, and is quickly extinguished. This is what herd immunity is all about: the outbreak is contained instead of spreading.
/!\ A very important thing to note is that this phenomenon is profitable for everyone in the population because overall, fewer people get infected, which is a good thing. This is especially true in cases where the disease can be fatal for healthy individuals. /!\
3. Mortality rate against immunity
If we plot the mortality rate of the weakest, against the immunity rate in the starting population, we obtain the following diagram.
As you can see, up to around 70%, nearly all weak individuals are wiped out by the disease. However, with more immune people, the disease begins to struggle finding new hosts. Only after a certain point can the disease no longer survive in the population. As long as the immune rate stays above this threshold, the impact of the disease is minimized – not null, as it can still spread a bit, but still very reduced.
This graph beautifully reveals the effect of herd immunity, and its strong dependence on the initial immunity rate in the population. A mere 10% difference in the initial conditions can have a huge impact.
In this post we have seen that, even though some people cannot survive a disease on their own, they can be protected by herd immunity during an epidemic. This highlights the fact that for immunity-based solutions to work, a high percentage of the population of individuals need to be immunized or the solution doesn’t work.
An individual choosing not to become immune poses not only a risk to him/herself, but to the whole population, and especially to its weakest individuals.
You can find the code here:
🎉 Thank you for reading, you’ve reached the end! 🎉