top of page

How To Model The Coronavirus Part 3

Introduction


Hello and welcome to another post on modelling the Coronavirus outbreak. This is the third part of the series. If you haven't read either one of the two posts on modelling the Coronavirus that I have uploaded before, then please check that out first: you will be confused otherwise! In the last post, we began by modelling the first 19 days of the virus outbreak, and we are now going to introduce the effects of a lockdown on the virus!


Implementing a Lockdown


Governments all the around the world have introduced strict lockdowns in order to prevent the transmission and spread of the viral outbreak. In effect, governments have utilised such a policy in order to bring the 'R' value straight down. As a result, we can introduce the effects of a lockdown into our model by simply gradually reducing the value of 'R'. A shortcut would be to simply change the our initial value of R (which we set as 3) to a smaller value, say 0.7, immediately after the lockdown was introduced.


However, this is very unrealistic as individuals took some time to gradually adapt to the new lockdown norm and thus the value of 'R' will not decrease to a smaller value instantaneously. This is what we are going to implement by creating our own 'exponential decay' equations for the value of R. I decided to use an exponential decay relationship as, in my opinion, the value of 'R' would decrease fairly quickly at the beginning (but not instantly) as the majority of individuals quickly begin to follow the lockdown rules. But, unfortunately, there will be individuals who will take a longer time to adapt to or follow the new lockdown, and, thus, the value of 'R' will take a considerably longer period of time to decrease by the same proportion than as it did before.


In relation to the UK, you can look at Day 20 as March 26th. This was the first Thursday following the introduction of a lockdown within the United Kingdom (and thus England as well). We are going to assume that the R value decreases to 0.65 by Day 79, representing May 8th. Obviously, this is an approximation, but we aren't trying to exactly model the Coronavirus outbreak per se. Although this is a massive simplification of the virus outbreak, we will still be able to see the impact that implementing a lockdown (or, later, the easing of a lockdown) has on the spread of a disease.


We now have our two boundary conditions. We know that the value of R on Day 20 is 3 and that, by Day 79, it should be 0.65. We also have assumed that it will follow an exponential decay relationship. A typical exponential decay relationship is shown in the image below:

An image showing the general exponential decay relationship.
A general exponential decay relationship.

We know that the value of R0 is 3 - this is, after all, the initial value of R on Day 20. From here, we just have to work out the constant 'k' and we will have a finished equation that we can implement.


The final value of R will be 0.65 and the initial value will be 3. Taking Day 20 to be our '0th day', we can calculate how many days there are between Day 20 and Day 79, which just comes out to 59. From here, we can set up an equation and just solve for 'k' (this involves manipulating natural logarithms):

An image of finding the value of k using natural logarithms.
Finding k using natural logarithms.

The value of k comes out to be 0.02592195262. Therefore, we can now begin 'hardcoding' this exponential decay relationship into our Coronavirus model. I have called it 'hardcoding' as we are not use any variables like before, but, rather, we are manually altering the value of R for specific cells. We could have utilised variables however I believe that this would not add much flexibility into our program. This is due to the fact that our exponential decay equation has been specifically engineered to change the value of R between Day 20 and Day 79 exactly like how we wanted it to.


In Cell E22, we will implement our exponential decay equation. I have included the formula below. It should be clear what it does - the G22 - 20 part of the formula is due to the fact that our exponential decay equation treats Day 20 as Day 0 (the initial day). Please see below:

An image showing a formula responsible for the exponential decay of the 'R' value.
Exponential decay of R formula.

Cell E22 should now consist of a value of 3. Bring this cell down until Cell E81 - this cell should read 0.65. In between these two cells, the values should be decreasing. The cells are thus displaying the current 'R' value at that specific point in time.


However, we must now create a new column of values as we must correspondingly change our infection rate, a, due to the fact that the value of R is constantly changing. We can achieve this by implementing a new function into Cell D22. This is almost exactly the same as before (when we created our initial formula for calculating the initial infection rate, a) but, this time, we will be referencing Cell E22, rather than before when we referenced Cell C8. For the formula, which will be inserted into Cell D22, see the image below:

An image showing the formula that is responsible for calculating the new infection rate.
Formula for calculating the new infection rate.

As before, drag Cell D22 down until you reach Cell D81. You should have a long list of very small numbers that are decreasing in value. Compare some of your values to my values below (if they are not identical, then you have probably made a mistake somewhere):

An image of some of the values from the Coronavirus model.
Check if your values are the same!

We are almost finished with implementing our 'lockdown'. The last thing that we need to do is to alter the formula for dS/dt for the days between, and including, 20 and 79. All the we need to do is reference the changing infection rate - the value of a - for each different day. Include this formula into Cell H22 and drag the cell down until you reach Cell H81. I have included an image of the respective formula below:

An image of the new formula for dS/dt for Cells H22-81.
The new formula for dS/dt for Cells H22-81.

Once you have done this, you can drag every column down, reaching Day 79 for each differential equation and variable within our table of values. I have included an image below of what your table should look like:

An image of the table of values for the Coronavirus model.
Check your values - they should be identical!

If your values are identical, then well done! If not, don't worry; have a read through this post again and try to spot your mistake. Often it is just a simple syntax error or you just typed the wrong number in. If you can't spot your mistake, then feel free to comment down below and I will assist you in any way that I can.


(IMAGE OF THE GRAPH OF INFECTIONS AND DEATHS - ANALYSE IT!)


What now?


You may be wondering "what now?". Well, we are now able to experiment and analyse the effects of another policy being put into place. The value of R has been driven right down due to the implementation of the lockdown. Since, in our model, it has just reached 0.65, it would perhaps make sense to continue this lockdown. However, let's suppose that the government decided to ease restrictions and overshot. In other words, the government underestimated the number of individuals who would return to work and did not institute adequate social distancing regulations. Obviously, in the real word, we don't want this to happen by any means. But, I think that it will be interesting to see the effects and, hopefully, we will be able to realise why easing up the lockdown too quickly is a deadly mistake.


We are going to now turn our attention to Cell E82. Essentially, we are going to assume that the lockdown is eased too quickly and, on May 31st, the value of R reaches 1.3 (this is just a hypothetical scenario). As mentioned on Part 1 of this series, we want the value of R to be below 1 to prevent exponential growth and to therefore allow the virus to die out. A value of 1.3 for R, therefore, will cause the virus to be transmitted exponentially, resulting in another peak of infection cases occurring. In effect, this is the 'second peak' that so many governments are afraid of. We are going to assume that the value of R increases exponentially between Days 80 and 102 from a value of 0.65 to 1.3. You could equally argue that the value of R will change in a different manner; however, we will assume that it is an exponential increase. One could argue for this as more and more individuals may increasingly leave self-isolation. For example, on Day 1 of the easing of the lockdown (so Day 80), only 100,000 individuals may decide to be confident enough to leave self-isolation. The next day, more individuals will leave self-isolation and so on, causing an exponential increase in the value of R as an increasing number of individuals interact with one another.


In order to create the exponential increase in the value of R, we are going to do the exact same calculation as before. The only difference is that we will not have a negative in the exponent as we did when we created a formula for an exponential decay relationship. The boundary conditions will be 0.65 and 1.3. Also, the difference in days will be 22 as we take Day 80 to be Day 0. We can now use this information to calculate the positive constant 'k' that will allow us to create the exponential growth of the value of R that we want. The algebra is the same as what we tackled before but I have included an image of it below:

An image of how to calculate the value of the positive constant using natural logarithms.
Finding the value of the constant.

The value of the constant, in this exponential relationship, is equivalent to 0.03150669003. Therefore, we now have our exponential equation for the value of R between days 80 and 102. Thus, in Cell E82, we must insert the following formula (it should be clear that we are doing the exact same process as we did before):

The '-80' comes from the fact that we are referring to Day 80 as Day 0 in our exponential function (we are taking the initial value of R as being 0.65). Drag Cell E82 down until you reach Cell E104, which corresponds to Day 102.


Now, in order to calculate the new value of the infection rate 'a' at each point in time, just simply drag down Cell D82 until you reach Cell D104. You should now have a long list of 'R' values and the corresponding values for the infection rate 'a'. I have included an image of the values below so that you can check whether you have correctly implemented the functions:

An image of the values of 'a' and 'R' for Days 80-102.
Values of 'a' and 'R' for Days 80-102.

Subsequently, drag every column down until you reach Day 102. Every column should now be updated and be full of values for Days 0-102.


We are now nearing the end of our Coronavirus modelling. For the next stage, for Days 103 to 125 (there is nothing special about 125 days; I just figured it was a nice number), we are going to assume that the 'R' value remains constant at 1.3. As before, this is just an estimate and simply serves a purpose to show us why easing up the lockdown too quickly is so dangerous. In order to implement this, manually add the value 1.3 into Cell E105 and drag this cell down until you reach Cell E127, corresponding to Day 125. Like before, refresh every column of values by dragging every column down until you reach Day 125. Moreover, do not forget to drag Cell D105 down until you reach Cell D127 in order to calculate the relevant infection rates.


For the days between and including 80 and 125, you should have a table of values that looks something like the one I have included below. Please check that you have identical values as otherwise you have done something wrong:

An image of the values of Days 80-125.
Values for Days 80-125.

We are so close to finishing our model! All we need to do now is to fill up the column titled 'Infections' - column P to be exact. This column records the cumulative number of infections whereas column M records the total number of current infections. In order to do this, we just have to subtract the current number of Susceptibles from the initial number of Susceptibles at that given point in time. In effect, if the number of Susceptibles has decreased by 1000, the number of infected individuals must have increased by 1000. Once those individuals are infected, they will either die or recover. In other words, they will never be able to transition back into the Susceptible state. Thus, by subtracting the current number of Susceptibles from the initial number of Susceptibles (which, if you recall, was just the population of England), you are calculating the total number of individuals that have been infected. You can do this very easily by putting in the formula (which is shown below) into Cell P2:

An image showing the function used to calculate the total number of infections.
Function to calculate the total number of infections.

The '$C$9' refers to the constant value of the initial number of susceptibles. 'L2' refers to the number of Susceptibles at that given point in time. After putting this function into Cell P2, drag the cell down until Cell P127 in order to calculate all the relevant values. You should now have filled up the 'Infections' column with values that are always increasing (the cumulative number of infections can never down!).


Conclusion


We have now finished our model and have successfully modelled the Coronavirus outbreak for the first 125 days! You may be thinking - "what is the point of having hundreds and hundreds of values?". Well, in the next post, we are going to analyse the data by plotting loads of different, cool graphs, comparing how each different part/approximation of our model has affected the total values. Feel free to comment any questions that you have down below and please share this post with your friends! Stay tuned for the final post, Part 4, which is going to be the most interesting one! Thank you for reading!

405 views0 comments

Comentarios


bottom of page