Member-only story

Jim Clarke
7 min readNov 16, 2020

--

A Simple Discrete Covid-19 Epidemic Model in Python

I’ve been simulating epidemics for years, I started when Ebola first hit our collective conscious years ago. It is a fascinating subject and you can always create a better simulation. This is a very simple model, but it will get you started and there are a number of easy ways to improve your model and simulate changes in public health policy.

This model is essentially a discrete implementation of the SIR Model. Susceptible Infectious Recovered(SIR) Model: In the SIR mathematical model, we divide the population ’N’ into three different categories

  • S(t), Susceptibles: This includes all the people that are capable of getting infected from an infectious disease.
  • I(t), Infected: This includes all the people that are infected from a disease and are suffering due to it.
  • R(t), Recovered: This includes the people who have recovered and are no more susceptible

S(t) + I(t) + R(t) = N

Instead I use a discrete simulation with a large array simulating our population of people. Why? I feel it is easier to modify the simulation in a discrete model and you don’t have to be extremely proficient in differential equations. You can vary the size of your population with the variable PopSize. I’ve found a Population size of 1,000 or a 100x100 array gives good results. Yes you can crank…

--

--

Jim Clarke
Jim Clarke

Written by Jim Clarke

Electronics Engineer with Masters in Physics and Masters in Operations Research.

Responses (1)