Skip to main content

Modelling the Spread of a Virus

I am currently in lockdown owing to the coronavirus pandemic that is sweeping the World.  It is apt therefore to present a model of epidemiology that shows how disease spreads through a population. Models of this type, but much more complex than the one presented here, are being used to inform national policies in order to reduce the devastating impact that the coronavirus is having on our societies.

The model here is based on a very simple idea.  You have a population that starts off with a single individual who is infected with a virus and sets off the chain of infection.  That person then infects a number of other people according to the transmission rate (more on this later).  Those people then infect other people and so on. Initially the rate of growth of the number of people infected is exponential, that is a doubling of people with the disease for every round of infections, which demonstrates just how difficult it is to contain a virus once is has broken out. But as people get infected and recover they then become immune to the virus.  The spread of the virus then plateaus and then reduces.  With an unvaccinated population a virus will rip through a population until many have been infected and gained immunity.  With a population that is vaccinated, then the spread of the virus is subdued much more rapidly even though not all people are inoculated against the virus.  The so called "herd immunity" is important in helping protect entire populations from outbreaks of disease.

The computer model work in this way.  We have a population of individuals that have 1 of 3 states.  Firstly, individuals can have no disease and no immunity and are susceptible to infection. Secondly, individuals can have the disease and spread it as well. Thirdly individuals can be permanently immune either because they have been inoculated against the disease, or have had the disease but recovered from it.  Each time step corresponds to a day and at each time step those individuals with the disease will infect a number of other people according to the transmission rate, R0.  R0 is an important concept in epidemiological modelling and determines the rate of spread of the disease.  The whole purpose of lockdown and associated measures such as social distancing, hand washing and so in is to reduce R0.  For coronavirus under business-as-usual circumstances R0 is said to be around 2.5.  That is each individual will on average infect between 2 and 3 people.  This is considered a highly infections disease.  Under lockdown, in the UK it though that R0 has been reduced to around 0.6, meaning that each infected person will infect on average 0 or 1 other person.  As time progresses more and more people will get the disease and recover with immunity, so the likelihood of meeting someone who is not immune will diminish over time. So too the likelihood of infecting someone else
will reduce.

Just what the impact of reducing R0 is illustrated nicely in the two plots below.  Initially R0 is set to 2.5 and the number of infections at the peak is more than twice that where R0 is 1.5.


By reducing R0 we are limiting the number of people who will become infected at a given time thereby "flattening the curve" and giving our NHS a fighting chance to treat all serious cases without being overwhelmed.

The code can be downloaded from https://github.com/wmfgrey/epidemiology.  I have presented this idea to my Year 12 students and they got on well with it developing their own models.  Feel free to tinker, improve and extend.

Comments

Popular posts from this blog

Mango Learning

We are a community of teachers that have developed extensive computing resources primarily aimed at the English secondary school curriculum that can be accessed here: www.mangolearning.academy .  Mango learning empowers teachers to deliver great lessons that explain complex ideas using clear and highly scaffolded teaching and learning resources. We are very excited to offer these resources for free to the community. These teaching and learning resources for computing are made by teachers for teachers and we understand the day-to-day challenges that teacher face.   The resources incorporate general and computing specific evidence-based pedagogy. We incorporated spaced retrieval practice though knowledge organisers, diagnostic questions and quizzes, for instance. We also incorporate ideas from cognitive load theory through lots of worked examples.   To help with coding we use PRIMM and block to text based pedagogical approaches.   To support literacy we address vocabulary head on, enco

Semantic Waves

In the previous post we looked at the transfer of learning from block based coding to text based languages.  Semantic waves offer a theory that help us to structure our lessons to support transfer of learning (Maton, Waite et al).  When we present concrete examples in single contexts transfer of learning is going to be weak.  We need to present multiple examples in a range of context.  This allows us to abstract out the underlaying features.  This idea of moving along a continuum between the abstract and concrete is given by the term semantic gravity.  For instance, if we talk about an algorithm in abstract terms we might say that it is a sequence of steps to solve a problem.  At this stage we have presented it as an abstract idea so has low semantic garvity.  In a lesson we might then go on and write algorithms for drawing squares.  This represents a concrete episode with high semantic gravity.  In a good lesson we might also want to give multiple examples of algorithm in different co

Teaching Children to Read Code using Evidence-based Approaches

Before students can write code, they need to be able to read code. Computer science pedagogy is often based around the ideas of Piaget’s constructivism - where pupils develop their knowledge through exploration, and Papert’s constructionism - where pupils learn through creating artifacts. However, evidence has shown that learners need guidance to gain useful knowledge efficiently and to organise that knowledge in a clear and logical way. They need to be able to break a problem down, remove the unnecessary detail, find patterns and think algorithmically before they can start to write programs for solving problems. Just as we wouldn’t expect a young child to write prose before they can read, we need to provide guided approaches that use direct instruction and scaffolding to help our students read code before they can be expected to write code themselves. These guided approaches are needed just as much as, if not more than, creative discovery activities. Explain the code My first approach