Compartmental models

With the novel coronavirus (SARS-CoV-2) epidemic, there are many people who are anxious and wondering what will happen in the future. In the field of infectious diseases, I think mathematical modelling is useful because disease outbreaks are triggered by some kind of transmission. I heard that people on campus want to study mathematical models, and I thought that if you actually create a model, you can understand the impact of social distancing, so I created web tools that implements the SEIR model using R shiny. If you have any comments, please point them out.

The SEIR model models the process of human transition in the following order using ordinary differential equations. (show wikipedia)

  • Susceptible; those without immunity
  • Exposed; those who is infected and in the incubation period
  • Infectious
  • Recovered; immunized

First, we specify the number of people in the four states S, E, I, and R, and then we determine the following three parameters to express the speed of the transition.

  • R0; the basic reproduction number
  • average incubation period; average period of stay in state E
  • average infectious period; average period of stay in state I

Here, the definition is that the disease does not infect others during the incubation period(state E), but can only infect others during the infectious period(state I). If the above three can be derived, it is possible to use other parameters. It also ignores that people are replaced by the presence of deaths and births in a population.

For SARS-CoV-2, according to Dr. Lauer’s paper (, the median incubation period (defined as the time from infection to onset of symptoms) is 5.1 days. Since it is natural to think that the distribution of the transition period from E to I follows an exponential distribution, if the median incubation period is 5.1 days, then the mean value is 7.35 days.

The European Centre for Disease Control and Prevention’s Q&A ( explains that the infectious period starts 1 or 2 days before the onset of symptoms and takes 7 to 12 days for anyone with symptoms. Therefore, we set the average incubation period as about 6 days and the average onset period as about 10 days as the default values in the web tool when making the SEIR model. Of course, many people will voluntarily quarantine themselves if symptoms are seen, so the average onset period may be set shorter than 10 days.

Impact of social distancing

If the infection is left untreated, only one person to R0 will be infected, but measures can actually reduce the number of infected people. With regard to SARS-CoV-2, since droplet transmission is now generally understood to be the route of transmission, social isolation, such as wearing a mask and keeping a distance of at least 2 meters from others, is now a possible measure.

For now, we will simply consider the effective reproduction number Rt, which represents the average number of people infected by one infected person at a given point in time, as the basic reproduction number multiplied by the proportion who could not reduce the frequency of contact (social isolation). For example, R0 is 2.5, but if we can reduce the contact by 80%, 2.5 x (1-0.8) = 0.5 is Rt.

The web tool charts the number of new infections and the number of hospitalizations by entering a reduction percentage, with one row representing one day.

The results are shown when the ratio of the Number of additional reductions to the initial value of S is added to the reduction ratio. Enter a negative value to show the result of increasing the contact frequency in reverse.

Using the web tool (another window will be opened)

R codes using shiny

R codes of SEIR model

2 thoughts on “The mathematical modelling of infectious disease; Sequential SEIR model”

  1. Age-dependency in host-vector models: The global analysis [J]. Applied Mathematics and Computation, 2014, 243: 969-981. Global stability of an SEIR epidemic model with age-dependent latency and relapse [J].

  2. Wow, this article is pleasant, my younger sister is analyzing these things, therefore I am going to inform her.

Comments are closed.