D3.js Herd Immunity with Vaccinations
This D3.js simulation was created by replicating an original gif posted to Reddit.
In this reproduction the following colours are used:
- A vaccinated individual not infected.
- An unvaccinated individual not infected.
- An infected individual able to pass on the infection.
Each time the button "Infect and Update" is pressed all currently infected people have the possibility of infecting someone close by. An unvaccinated person will have a high chance to be infected and a vaccinated person will have a low chance.
Currently the simulation will attempt to infect anyone close by, infinitely. However in real life most conditions have a rate of infection, typically donated by the amount of people each infected person will then infect. For air borne infections this rate will be much higher as it is easier to pass on.
By clicking several times on the above button the infection spreads quickly to the population that has not been vaccinated. As the proportion of vaccinated individuals increases it is clear to see that the infection is stopped more quickly.
In the same time that it takes for the unvaccinated population to be completely infected, the highest vaccination levels still have very little infection. This is because the infection is only meeting those who have been vaccinated before and therefore have a very small chance of contracting the illness.
Stopping the infection spreading to the entire population quickly is important as some individuals will be unable to be vaccinated due to health problems. By having a large vaccination rate it will reduce the likelihood of those individuals unable to become vaccinated becoming infected.
Example code and full discussion
The full code is available by viewing the source of the above frame. A full discussion of the code and future plans with the Herd Immunity Vaccination display is available in my blog post.