Search
  • Mr Ironside

Coronavirus Modelling

Download the (large Excel file) and try it yourself. Link is in the text.


This is a very important task and professionals working in the field of modelling disease spread (epidemiology) are advising the government about the impact that ministers’ decisions will have.


Later I will give you a link to a model I have developed that will allow you to experiment with some of the parameters involved and show you how sensitive the results are to changes in the factors involved.


I have always been very keen on developing graphical intelligence in students. ‘Every picture tells a story’ is a truism that first appeared in an early 20th century advertisement for kidney pills, but it applies very much to scientific data too. The image puts the whole data set in context and while words can draw attention to some features it is amazing how much useful information can come from reading intelligently the shape and spread of data presented in graphical form. It’s a skill worth developing for future experts in all fields (from economics to law, to history and the social sciences as well as the obvious sciences and medicine).

Scientists use graphs to explore how a system is working, showing their results in a visual way. They try to come up with mathematical models that would give the same shape of curve and see if predictions based on the models match what the observe in their experiments.

Politicians are currently relying on mathematical models to determine when to relax the current social distancing rules that are being enforced and we will do some modelling to help them in a moment.


The study of the spread of infectious diseases is called epidemiology. There are two main approaches: 1. Write down formulae based on the rates of change of important variables such as the number in a population who are sick. These expressions are called differential equations. Simple differential equations are covered in the A-level maths course; another important topic that uses them is the motion of particles in physics. In the case of infectious diseases the main assumption is that viral infections spread by contact between infected people and uninfected (or susceptible) people. One important model of this type is the SIR model (S= number who are susceptible, I = number who are ill, R = number who have recovered). This model assumes that when you recover you have immunity and so play no further part in the spread of the disease. Simple models of this type can be solved analytically (y13 A-level maths topic). The relative rate of infection and recovery is a key parameter. It can be shown that epidemics only develop (however contagious the virus) if there is a minimum number of infected individuals initially, which is a feature of the solutions of the equations – if they represent reality. If you can isolate populations soon enough you can stop a serious viral illness from reaching the epidemic proportions that this one has.


Models can be adapted to include details of the observed mechanism for spreading, but these complications such as incubation periods, when is an infected person contagious, and different responses in different age and ethnic groups, quickly make the equations too hard to solve analytically and numerical solutions have to be relied on.


2. The second main approach is to use probability models (called stochastic models). Each individual is looked at in an interval of time and the probability of changing state from, say, well to infected or staying well or changing from sick to recovered or sick to dead is considered. One topic here is called Markov chains, within the scope of y13 mathematicians but not on the syllabus.


Within the stochastic approach it is possible to use very simple models to simulate complex situations. In physics in year 10 you look at the random nature of probability by either throwing dice or using random numbers to determine whether a particular atom decays in the next short interval of time. Plotting the number of atoms left at each stage against time gives graphs that replicate radioactive decay.


Let’s try the same approach with coronavirus spread.


The equations I mentioned earlier assume that in a period of time the number of contacts between people will affect how many get infected. This is like in chemistry, where the law of action says that the rate of reaction is proportional to the product of the mass of the reactants. This assumes rapid mixing of reactants and the same is true of the disease spread models too; however, it is not a realistic assumption in a large city. Somebody living in North London is not going to infect somebody living in Sutton as easily as a near neighbour. The whole idea of social distancing is to reduce the total number of contacts.


I have produced a model of infection in a town of 10,000 people. They live on a 100 x 100 grid.


When social distancing is operating, people interact with a much smaller number of other people. I use a 4 point scale. With d=1, a person only has contact with the 8 people in a 3 x 3 square around them, with d=2 with the 24 people in a 5 x 5 square around them, with d=3 with the 48 people around them and with d=4 with the 80 people around them.


In each time interval (say 1 day) the model assumes there is a chance of an infected person passing on the infection to any near neighbour in his contact group. Random numbers are used to decide whether that happens or not. In a single run of this experiment we shall use a random number (like throwing a die) about 2 million times – so computers do the donkey work for us and do all the counting for us, keeping track of the state of each of the 10,000 people at every interval of time.


Once a person is infected it sets a clock running. The model assumes that an ill person either recovers after eight days or he dies during that period – the best estimate of the chance of dying is 0.022, using published data from around the world – but you can set different values in the model.


When the person recovers is he immune or might he still be infectious? I have assumed that he is partially immune and so has a smaller chance of re-infection. If a vaccine is developed, from that time onward most of those vaccinated will have a much smaller probability of being infected and that can be put into the model at a time you choose. If you think a recovered person is immune set the probability of reinfection at 0.


The results are in tables and graphs. Here is a graph of one run of the model for this town of 10,000 people.



Features: 1. The rapid rise of cases initially. 2. Some oscillation between the infected and well/recovered. 3. Tighter distancing at day 50 causes a fall in those ill. 4. In phase 3 we have assumed technical advances in care so a reduced death rate and perhaps some progress with a vaccine so a reduced (but not zero chance of infection). The epidemic is well on the way to being ended even though social distancing is relaxed in phase 3 too.

The oscillations are interesting and come out of the interplay between the numbers in each group not because of any intervention or change in procedures. When measles data was studied in the 1930s these oscillating patterns were observed and not understood.

It is much more interesting to look at the data yourself rather than read about it.

The link below will download to your computer a 48Mb Excel worksheet that will let you explore some of the features yourself.


https://www.dropbox.com/s/punilda7vacp4fe/coronavirus%20model.xlsx?dl=0


It is a big file so it will take several minutes to load. You will need Excel on your computer. Move your screen to the section of the sheet from about cells DO105 to EQ145 to allow you to see where you can change values and look at the results graphs.

The bars let you change five things: p(die)= probability of an infected person dying p(infect) = prob of being infected during a contact with an infected person p(reinfect) = prob of being re-infected after recovery during a contact with an infected person social distance = 1,2,3 or 4 phases = 1,2, or 3 This lets you vary the conditions over time. You enter the time the new phase starts. I suggest starting with changing only one thing at a time and having a single phase too, so to start put phase 2= 90 and phase 3 = 90.


Try also running several times with exactly the same values: each run is different because chance comes into the detail through the use of random numbers: however mostly the changes will be small for the model looks very stable.


I suggest die =22, infect = 70, reinfect=30 and try d = 4, then 3, then 2 then 1. These numbers are on sliders – the actual probabilities are also shown on the display. They won’t recalculate until you press calculate now (wait until you have chosen all values). You can also type the numbers in the yellow boxes rather than use the sliders.


The first section of cells from I13 to DD113 shows the location of the infected people at the start. I have done some runs with the 12 initial cases spread all over the town and others with the 12 all in a clump. It makes a big difference to the shape of the graphs - if you can close down the infection by early isolation, the peak of numbers ill is much reduced and the total deaths are also reduced. If you want to make changes change all the cells in the first time interval from I13 to DD113 to 0 and then put your first seed infected people in with the number 1 in a small number of cells.


Make sure to set the calculate mode to manual (on the ‘formula’ tab, choose ‘calculate options’ then ‘manual’ and then when you have set all your values press either ‘calculate now’ or ‘calculate sheet’ and it takes about 20 seconds to run the simulation for 90 days and show the graph of results.


Jot down the values you try and the main features of the graphs you see. I think you will be able to replicate most of the features I have seen the ‘experts’ talking about on the TV.


Computer whizzes amongst you will be able to code much more efficiently than me and make it run faster - but my spreadsheet is a start and allows exploration of a lot of features realistically.


There is lots to find and investigate here (it would make a good Big Bang entry next year!!) and to think about and you will see some of the complexity of the decision making in this area. Tell me about your findings.

Mr Ironside 21 April 2020

187 views1 comment

020 8642 3821

Manor Ln, Sutton SM1 4AS, UK

©2020 by Keep Faith. Proudly created with Wix.com