communications · CompSci_Studies · download · Health · medicine

Epidemiological models (SIR) in nCov and Other Epidemics

Reading Time: 4 minutes

Epidemic is an incident, in time, where typically a large proportion of a population gets ill.

Corona-virus pandemic of 2019 is causing an epidemic. Originally detected somewhere in December 2019, we are still (March 20th 2020) in midst of the rising tide of infection cases. The causing virus is called specifically ‘Severe acute respiratory syndrome coronavirus 2″, or SARS-CoV-2 for short. Another alias for the exact same virus is nCov. The disease that results from this virus is called COVID-19.

The virus – cause of the epidemic

A virus — photo by CDC on Unsplash

The biological root of an epidemic is called an antigen. With the novel Corona-virus pandemic, it’s a virus in the “corona family”.

There have been corona viruses in the wild before this 2019-2020 epidemic.

Viruses are small, lifeless objects per se, who carry either a DNA or RNA code, and can drift to hijack a working cell’s production mechanism, so that the cells start producing replicants of the virus. Thus normal functioning of the cells are interrupted and the virus population starts to grow.

Corona (nCOV) leading to the disease COVID-19 is a RNA-virus. Thus the replication message carried is in the form of ribonucleic acid. See Wikipedia: RNA-virus.

As one virus can reproduce many other viruses, the growth curve of the mass of viruses is exponential in shape. It’s similar to the mechanism of nuclear fission – the mechanism of nuclear weapons. Many biological processes are exponential.

The growth often also has a natural limiting factor, thus there’s resistance. In human bodies, resistance may come in the form of immunity fighting back the spread of the virus. A virus may also simply exhaust the host or exhausting a critical matter that is needed to replicate; leading to either sustained levels of viral presence, or decay of the level.

The antigen causes the symptoms and capability to transmit the disease to another person. The branch of medicine and science that deals with epidemics is called epidemiology.

Mathematical models for viral epidemics

There are lot of mathematics which is useful in modeling these epidemics. Some of maths is actually quite simple, and can be understood perhaps better with computer simulation.

There’s a few “main ideas” of viral outbreak simulations:

  • differential equations (called DE, or ‘ODE’)
  • agent-based simulation
  • AI models, such as using autoencoders [Wikipedia: autoencoder]

The simplest epidemic models choose variables that predict the amounts of people in various stages of the disease. People move (permanently) from one compartment towards the final compartment, which is ‘Recovered’. A recovered person means one who has either gotten immune (healthy), or died.

People always thus essentially end up in the Recovered state. This means also that these kind of models assume the epidemic goes through 100% of the people; for an individual, thus, the question wouldn’t be “whether I will get infected”, but “when (is it) I will get infected”.

In real life, there’s actually only a few things that potentially can prevent an infection from ever happening. One of those is that during the epidemic, a vaccine is found. Thus this would “freeze” the situation (number of population allocated into each compartments), given that the nations have funds to provide vaccination and given that everyone is willing to get vaccinated.

Thus an epidemic has a few interesting elements to it:

  • properties of the virus
  • sociology of a population, among which the virus is spreading
  • remedies available to stop the virus spreading
  • effectiveness of communicating the correct information and situational awareness to target population
  • availability and cost of the cure, if a person has gotten Infected
Photo by CDC on Unsplash

One of the most famous model, a set of differential equations, is called SIR model. SIR is a “compartmental model”: it places people into exactly one compartment at any given time. In SIR, for example, people can be:

  • Susceptible
  • Infected
  • Resolved

Actual, recognizable individuals (single people) are not “tracked” in these models – rather; the numbers of people in each compartment are calculated as function of time. So the model itself doesn’t identify individuals who are infected, but the use of the model is fed with real numbers. The statistics of infected (tested) people gives epidemiologists, citizens and any stakeholders during the management and containment a lot of important information.

Population models produce numeric results that can be plotted as curves.

Contained population: sum S+I+R

There’s one particular limitation set in SIR model, by design: the sum of compartmentalized populations is constant, and equal to initial population of the study:

  • in SIR model, summing S+I+R is always constant => equal to the initial population
  • thus in SIR model, births are not allowed
  • “R” includes both cured (immune) and deaths

These models were largely formulated in 1927.

Recipe for using SIR epidemiologic model

  • initialize all 3 compartments to values (populations)
  • define 4 parameters for the differential equations
  • there will be 3 differential equations, one for each population
  • in SIR, the populations are S=susceptible (healthy), I = infected, R = recovered
  • run a ODE solver algorithm, usually provided as part of your programming language of choice
  • for example, R language has “deSolve” libary and a ode() function, for example
  • for R language, there’s also ready-made code libraries for the particular SIR model; for example, one called EpiDynamics
  • ode() or the appropriate modeling function returns as result the values of each function (corresponding to one function per compartment)
  • you can plot the functions, all on a same diagram (axes t for time, and autoscaling Y axis as per quantity) to get an overall image of how the epidemic turns out

Some suggested reading

Btw. Getting R for experimenting with math modeling – it’s a snap! It took me less than 15 minutes to install both free RStudio and the underlying R programming environment. Definitely recommended!


Gleam of Green Tea

Reading Time: < 1 minuteIt’s one of my first cups of the product right there.


It’s an interesting journey to produce a cup of hot green tea. Yesterday I bought the ingredients: a tea strainer and some green tea (in a pouch). As with everything experimental, it’s a fascinating thing to enter a new world. There’s questions, you see, and some learning with the process.

Making the morning porridge has been a good teacher for me. Easily understated amount of work. Porridge entails all the things you actually never (even with a slightly inclination to homo faber kind of mentality) want! (But that’s another story)

A little so with green tea, too! No wonder I’ve been a coffee drinker for so long. Let’s get down to it:

  • still to learn how to actually fill the tea strainer from the mass of crisp (and bouncy) green tea snippets (without making for a round of vacuuming)
  • tried grinding the dry green tea leaves finer with a stavmixer
  • does a coffee filter paper do any harm, as in when I’m trying to make the end product a bit more clear and devoid of green tea particles?

Green tea is said to contain a lot of antioxidants. I’ll keep on experimenting!

Want to hear more from this?

Have a look at Wikipedia: Green tea.

See you!


Forest bathing

Reading Time: < 1 minute

Forest bathing is the practice of taking a short, leisurely visit to a forest for health benefits.

I was indeed surprised to find an article of this phenomenon, “forest bathing”. For example in Japan, the local authorities (according to Wikipedia) have suggested as early as 1982, that walking in the forest is a way to relieve stress and help maintain healthy lifestyle.