Yuvan Sharma
20 Feb 2020: Modelling the Coronavirus using Markov Chains
20.02.20203 Min Read — In Coding

Note: I wrote this blog in Feb 2020 after learning Markov Chains and how to use difference equations. The covid19 pandemic that followed had just begun and, at that time, no one knew how serious it will be. This shows the power of mathematics and modelling.

What are Markov Chains?

A Markov chain can be most simply understood as a mathematical system that models certain transitions from one state to another using probability. It has different probabilities for different transitions, and when real data is modelled using these chains, a prediction can be obtained. The accuracy of this prediction depends on the accuracy of the probabilistic values.

The Purpose

The main purpose of this project was to see how different decisions of quarantine and social distancing can lead to huge changes in the coronavirus data. The results showed that whether the global situation improves or becomes worse depends almost fully on the decisions world leaders and governments make to contain the spread of the virus.

The Experiment

I decided to study two types of systems: one where there is absolutely no quarantine and people venture out as if they are blissfully unaware that we have a pandemic on our hands, and the second where half of the population is placed under quarantine.

Example 1: Markov Chain in a No-Quarantine case.

Let’s start with the simplest Markovian model. A diagram of the 6-state No-Quarantine model is shown below. We start with a population of 10,000 people, and we allow both healthy and sick to stay in one place with no quarantine or isolation at all. This means healthy individuals first contract the virus and are contagious without showing symptoms, contagious people eventually show symptoms, symptomatic people fall sick, sick people become critical, and some critically ill people die. We increment these 6-states into discrete 1-day timesteps. The probability of a person remaining in the same state is 0.9, and the probability of transitioning to the next state is 0.1. I obtained the graph for the Markov chain using Google Sheets, where I multiplied the probabilities of each transition with the number of people in that state for each day, and then plotted the graph of each day’s numbers. If we simulate this Markov chain, all people will eventually die, which is not a favorable scenario at all. This is shown in the results graph below:

The Markov Chain

The Markov Chain

The Markov Chain

The Graph for the Markov Chain

Conclusions: In the first 7 days, 3000 people become contagious without knowing, only 1000 people show symptoms and there is only one death. The “hockey puck” curve really starts rising with only 300 deaths by day 20, by which time 2900 people are symptomatic, 2900 people are contagious healthy and another 1000 fully healthy.

Example 2: Markov Chain in a Half Quarantine case.

We now modify the diagram to a 7-state model. Again starting with a population of 10,000 people, we now take half the symptomatic people and quarantine them away from the general population. The probabilities for the Markov chain remain the same so that we can see how much effect quarantine has on the same exact situation.

These quarantined people are supposed to fully recover on their own. We want to see if this reduces the death rate.

The Markov Chain

The Markov Chain

The Markov Chain

The Graph for the Markov Chain

Conclusions: There is still a lag. However, by just identifying symptomatic people and quarantining only half of them, we are able to “save” 8350 people. Finally, there are only 1650 deaths.

The Implications

I feel that this project shows just how much this situation depends on the response of the human community. From the first example, we see that if people do not quarantine at all, the virus can spread really fast and affect almost the entire population. This is of increased relevance in countries who have successfully countered the first wave of infections and are reopening. Returning to normal life without any precautions at all can have disastrous consequences. By quarantining just half of the total symptomatic population each day, we can save a huge number of people. Thus, this model shows how different decisions can have a huge impact on the result of the same situation, and how we must stay vigilant in order to minimize the damage caused by this pandemic.