Infectious Disease Simulation

Anthony Doe
5 min readDec 13, 2020

This semester changed the way I approached computer programming. Since beginning university, I knew it was extremely useful in complex engineering applications, but I always thought it was too difficult to be used by individuals or small organizations. However, completing my Scientific Computation course changed my perspective. Programming can really be used as another language to communicate problems and solutions. For our final project we had the option of creating an infectious disease simulation using C++. After creating the model and running several simulations, I realized how valuable such data could be to non-profits looking to prevent outbreaks in communities they serve.

Simulating how infectious diseases spread through populations is a useful tool in public health policy and implementing public health measures. The value of such models is even more evident in light of the COVID-19 pandemic. Models can provide rough estimates of

  1. How quickly a disease will spread in a population
  2. How many people in a population will contract the disease

By adjusting parameters such as the initial percentage of vaccinated people in a population and how many people a carrier comes into contact with, the infectious disease model will change.

For my “spreading” model, I considered a population of 4,200,000 people. This is similar to the population of Panama. I was curious to investigate how an infectious disease may spread through a population of a similar size. My parameters were:

  • Population: 4,200,000
  • Vaccinated population: 5%, 15%, 25%
  • Transmission probability: 8%-25%, in increments of 2%
  • Number of people an infected person comes into contact with per day: 6 people

Building Blocks

To work my way up to a somewhat sophisticated spreading model, I created three simpler models. At the most basic level, one person became infected, carried the disease for a certain amount of days, and then recovered. The probability of infection determines which day the person will become infected.

In the second building block a population is considered, however the disease cannot be transmitted. Thus, only one person becomes infected. After the person recovers the simulation ends.

The third building block considered a population, a disease that is able to be transmitted, the probability that the disease is transmitted, and percentage of the initial population that is vaccinated. The population is represented as a vector of “N” people, the probability that the disease is transmitted is input by the user, and the percentage of the population that is vaccinated is input by the user.

The initial population contains a single infected person. This person is only able to spread it to their “left” and “right” neighbors. As previously stated, the transmission probability is inputted by the user. If one of their neighbors catches the disease, they too are only able to transmit it to their “left” and “right” neighbors. The disease essentially moves through the population away from the original infected person. It continues being transmitted until a person is no longer able to spread it to their “left” or “right” neighbor. Since a person is infected for 5 days, they have 5 chances to pass the disease to their neighbor.

Spreading Model

The spreading model considered a population, a disease that is able to be transmitted, the probability that the disease is transmitted, and the percentage of the population that is vaccinated. The population is represented as a vector of “N” people, the probability that the disease is transmitted is input by the user, and the percentage of the population that is vaccinated is input by the user. Unlike the final building block model, in the spreading model, an infected person can transmit the disease to anyone in the population. In my model, an infected person encounters 6 random people per day. The disease can only be transmitted to people who are susceptible, but healthy. For this model, I simulated disease spread for percentage of population vaccinated at: 5%, 15%, and 25%. For each vaccination percentage, I ran 11 simulations with transmission probability varying from 8% to 25% (and 15%), increasing in increments of 2%. Results are below.

The above chart compares the impact vaccination has on the number of days an infectious disease spreads in a population, depending on the transmission probability
The above chart compares the impact vaccination has on the number of susceptible but healthy people in a population, depending on the transmission probability
The above chart compares the impact vaccination has on the number of people who become infected in a population, depending on the transmission probability

We can see that as the percentage of people vaccinated increases, the number of days the disease remains active in the population increases. The plot shifts upward. Despite the disease remaining active in the population longer as vaccination percentage increases, the number of people who become infected decreases. Moreover, the number of people who are susceptible but healthy at the end of the simulation increases. Considering this, we can clearly see that an increased percentage of vaccinated people is good for the overall health of the population.

Additionally, there were two scenarios in which the disease did not spread:

  1. A transmission probability less than 8%; percentage of people vaccinated did not matter
  2. Percentage of people vaccinated in the population greater than 29% with transmission probability equal to 15%

In general, as transmission probability decreases, the necessary percentage of people vaccinated in a population to limit the spread decreases as well.

Potential Simulations

Currently, the program considers 4 inputs from the user:

  1. Population Size
  2. Infectious disease transmission probability
  3. The percentage of people vaccinated in the population
  4. How many people an infected person comes into contact with each day

Additional parameters could make the simulation more accurate and flexible. These additional parameters and their reasonings are below.

  1. Carrier period: Diseases have different infection time periods. By inputting carrier periods, the user would be able to simulate the spread of different disease
  2. Number of people infected in the initial population: Public health authorities become aware of an infectious disease spreading in their population at different times. If they are “late,” they may become aware of its presence when 100 or 1,000 people are infected rather than 1 person. Therefore, asking the user to input how many people are initially infected essentially starts the simulation at different points in the spread
  3. Vaccinating people each day in the simulation: In reality, a vaccine could be introduced into a population as the disease is still active. For example, the COVID-19 vaccine will be introduced in the coming months while the disease is still active. To simulate this, the model can vaccinate people each day of the simulation. The number of people vaccinated can be input by the user.

I hope this infectious disease simulation example illustrates that computer programming can be used as a tool to solve relevant problems. In my experience, it’s easier to think of how computing can be used to solve problems that I am passionate about. So, I encourage you to do the same!

--

--