## Figures

## Abstract

The paradigm for compartment models in epidemiology assumes exponentially distributed incubation and removal times, which is not realistic in actual populations. Commonly used variations with multiple exponentially distributed variables are more flexible, yet do not allow for arbitrary distributions. We present a new formulation, focussing on the SEIR concept that allows to include general distributions of incubation and removal times. We compare the solution to two types of agent-based model simulations, a spatially homogeneous one where infection occurs by proximity, and a model on a scale-free network with varying clustering properties, where the infection between any two agents occurs via their link if it exists. We find good agreement in both cases. Furthermore a family of asymptotic solutions of the equations is found in terms of a logistic curve, which after a non-universal time shift, fits extremely well all the microdynamical simulations. The formulation allows for a simple numerical approach; software in Julia and Python is provided.

**Citation: **Hernández P, Pena C, Ramos A, Gómez-Cadenas JJ (2021) A new formulation of compartmental epidemic modelling for arbitrary distributions of incubation and removal times. PLoS ONE 16(2):
e0244107.
https://doi.org/10.1371/journal.pone.0244107

**Editor: **Eric Forgoston,
Montclair State University, UNITED STATES

**Received: **May 27, 2020; **Accepted: **December 2, 2020; **Published: ** February 3, 2021

**Copyright: ** © 2021 Hernández et al. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.

**Data Availability: **The data in our figures can all be found in the OSF public repository: https://osf.io/cdakv/files/ including the data from the microdynamical simulations (ABM and networks) as well as a Mathematica notebook that constructs the figures. The software that we have implemented to solve the uSEIR equations in the most general case is available in Julia and Python and can be downloaded from https://gitlab.ift.uam-csic.es/alberto/useir https://github.com/jjgomezcadenas/useirn.

**Funding: **The author(s) received no specific funding for this work.

**Competing interests: ** The authors have declared that no competing interests exist.

## Introduction

A burgeoning number of papers attempting to model the dynamics of the COVID-19 pandemic have been published over the last few months [1]. Among these, a large fraction ([2–4] are just a few examples) are based in more or less complex variants of the classical SEIR (susceptible-exposed/preinfectious-infectious-removed) model [5], which assume exponential distributions of incubation and removal times. Real epidemic data do not support however an exponential distribution for these parameters which are usually described by gamma, lognormal or Weibull distributions [6, 7].

It is well-known that these more general distributions are difficult to be captured by classical compartmental models such as SEIR, which normally treat the incubation and removal times as exponentially distributed, or as the sum of several exponentially-distributed independent times. On the other hand, there is a vast literature on the study of non-Markovian stochastic processes to model epidemics [8], but no simple and concrete formulation of compartmental models for epidemics that implements general distributions. The goal of this paper is to provide such a formulation, which is also practical from a numerical point of view.

The principles on which a completely general formulation of compartmental models can be built are actually already present in the seminal work by Kermack and McKendrick [9], where they considered the SIR model. Here, we focus on the more general SEIR model. Our starting point is a formulation of the SEIR concept that correctly represents the evolution of an epidemic under the assumption of full homogeneity and fixed values of the microscopic parameters, namely: i) number of contacts per unit time, ii) the probability of infection per contact, iii) the incubation time and iv) the recovery/removal time. By construction the inter-compartment probabilistic transition rates transparently conserve the total probability as time evolves: we thus refer to our construction as uSEIR, where “u” stands for unitary.

We demonstrate that the results of uSEIR describe very well the result of a microscopic Agent Based Model (ABM) simulation with no stochasticity in the model parameters. Arbitrary distribution of the incubation and removal times can be easily incorporated into our equations, recovering the classical SEIR equations in the particular case of exponentially-distributed incubation and removal times. We also show that the resulting equations can be efficiently solved numerically, and provide appropriate codes and examples (with implementations in the Julia and Python/Cython languages).

The non-homogeneity in the infection rate per unit time is more subtle, because, in the extreme case, it should invalidate the treatment in terms of global S-E-I-R populations. We study two sources of this non-uniformity: inhomogeneity in the probability of infection per contact and inhomogeneity in the number of contacts per individual. The first is modelled with an ABM model with a negative binomial distribution of the probability of infection per contact, the second is modelled with a simulation on a scale-free network. The uSEIR equations represent instead the evolution in which the infection rate per unit time is the average one, independently of the underlying distribution. We observe that the simulations show a significant variance which however amounts mostly to a time-translation. When the different curves of infected individuals are shifted to tune their maxima, all the curves fall on a universal curve correctly reproduced by the uSEIR equations. We analyse the origin of this universality, i.e., independence on initial conditions. It derives from an asymptotic solution of the uSEIR equations, which is found to be a logistic curve whose shape is fixed by the average microscopic parameters. In the case of networks we briefly comment on the effect of clustering on the dynamics of the epidemic.

## Epidemic dynamics: From local to global

The spread of an infectious agent in a large population is a complex stochastic process, which under certain assumptions can be described in terms of a relatively small number of global variables, which follow deterministic differential equations. In order to understand the underlying dynamics, it is useful to think of an epidemic outbreak in terms of simple agent-based models (ABMs) [10], where the microdynamics can be studied by computer simulations. In these models agents can make their own decisions based on the rules given to them, and the evolution can capture unexpected aggregate phenomena that result from combined individual behaviours. ABMs can incorporate easily stochastic parameters as well as heterogeneities in the population, and they are therefore a useful tool to study the performance of the description in terms of global variables.

In the context of an epidemic, agents have four possible states: Susceptible (S), Exposed (E), Infectious(I) and Removed (R). Only infectious agents can induce the change of state of another susceptible agent to that of exposed with a given infection rate, *r*_{S → E}. Each exposed agent necessarily becomes infectious after an incubation time, *t*_{i}, while each infectious agent remains in this state only during the recovery/removal time interval, *t*_{r}. In a real epidemic this time would be the interval of time during which an individual remains infectious. The agent can move to the removed compartment either because it dies, recovers or gets isolated. All these outcomes are equivalent as regards the evolution of the epidemic, which is monitored by the total fraction of agents in states *S*(*t*), *E*(*t*), *I*(*t*), *R*(*t*) at any given time. The study of an epidemic in terms of these variables is the SEIR paradigm [9]. In this context, the so-called basic reproduction number, *R*_{0}, is a fundamental quantity that controls the rate of infection in an homogeneous susceptible population. It is defined as the average number of individuals that a given infectious agent turn to exposed in the interval *t*_{r}, assuming a fully homogeneous and susceptible population.

In this paper we want to derive a set of equations for these global variables that describe correctly the global dynamics under the necessary assumption of a well-mixed and homogeneous population, if seen at a sufficiently large scale, but that incorporates arbitrary distributions of incubation, removal and infection rates in the microdynamics. These set of equations will be presented in the next section, where they will be benchmarked against two types of ABM simulations, that we briefly describe next. In the first type of ABMs, a number *N* of agents progressing through the S-E-I-R compartments move in an homogeneous space and get exposed by proximity to infected neighbours with some probability. The second type of models assumes the evolution on a network where the agents have a varying number of contacts.

### Spatially homogeneous ABM

We use the MESA package [11] to simulate the spread of an outbreak in a homogeneous population. The agents in the model are called “turtles”, following the nomenclature of the NetLogo [12] software. A two-dimensional turtle world is divided in a grid of equal size cells, and inhabited by *N* turtles. At the initial time the turtles occupy a randomly chosen cell and at each clock tick they do a random move to a neighbouring cells or stay in the same one.

To simulate the evolution of an epidemic, a small number of turtles are infectious, *I*_{0}, at the initial time, while *S*_{0} = *N* − *I*_{0} are susceptible. At each clock tick infectious (I) turtles can expose any susceptible (S) turtle they find in their neighbourhood. Two turtles are considered neighbours if they share the same cell or are in neighbouring ones.

More concretely, at each time step each susceptible neighbour of an infected turtle, *k* is exposed with probability *p*. If the neighbour *k* becomes exposed, the clock time of this event is recorded, . At each tick all the exposed turtles are examined and eventually turned into infectious, at time . Again, the time at which the transition to infectious happens is recorded, , and the turtle remains infectious until it progresses to the recovered compartment of time .

The basic assumption of homogeneity at large scales or full-mixing of the S-E-I-R populations requires that the probability of infection per contact is small enough. Only in the limit *p* → 0 we can expect that the infecting agent sees an average population of susceptibles (i.e the turtles have time to diffuse before a second infection succeeds). In this limit, the basic reproductive number is given by
(1)
where *c* is the average number of neighbours or contacts per unit time. For the rules described before, and in the case of a turtle world homogeneous population, *c* is simply:
(2)
where *A* is the total number of grid cells in the turtle world and 9 is the number of neighbouring cells of any given cell (including itself). *ϵ* is the measure of one time step. Therefore, the infection probability can be obtained from any desired *R*_{0} as:
(3)

The simulation with this *p* will only match the input value of *R*_{0} in the simulation if *p* is small enough, so that the assumptions that go in the derivation of this formula are satisfied. The simulation is run for a time *t* ≫ *t*_{r} and we use a step such that *t*_{r}/*ϵ* ∼ 30.

This basic simulation setup has to be supplemented with a prescription to choose the times that turtles remain exposed/infectious. A very common assumption is to take these times exponentially distributed. This can be interpreted as each turtle trying to leave the exposed/infectious compartments at each time tick with a fixed probability, leading to a Poisson process. Other (more realistic) choices of distribution (gamma, Weibull, etc) allow to model some inhomogeneity in the population. In this case, the evolution of the disease is described by a non-Markovian SEIR model.

At each step the software records the turtles in each compartment and thus provides (in the limit of small clock ticks) the functions *S*(*t*), *E*(*t*), *I*(*t*) and *R*(*t*), which can be directly compared with the predictions of the solutions of the SEIR models.

### ABM on networks

Realistic populations are not necessarily well-mixed, at least not at small scales. Most individuals have contact only with a very small fraction of the total population. Complex networks show very rich topological features that are similar to real-world social networks. They can have a small number of links between nodes and still display the small-world phenomena. Scale-free networks can also capture the large difference of contacts that different individuals in society have. The study of the evolution of diseases on complex networks allows to study the impact of this rich topological structure in the evolution of and epidemic. The spread of epidemics on networks is an area of intense research. Since the seminal works [13] many studies have been performed on this topic (see the recent review [14] and references therein).

A network is just a non-oriented graph {*G*, *E*} consisting on nodes and edges linking two nodes, *E* = {*e*_{ij}}. We say that two nodes *n*_{a} and *n*_{b} are connected if *e*_{ab} ∈ *E*. The number of edges attached to a node *n*_{a} is called its degree and labelled *k*_{a}.

In the context of the spread of an infectious disease, each node is an agent, and the edges represent the contacts. Each contact links two agents that can expose each other if one is infectious and the other susceptible. The number of edges is therefore the number of contacts. At each tick of time, *ϵ* ≪ *t*_{r}, infectious nodes pick a single edge at random, and if susceptible they attempt to infect the node attached to it with probability *p*. In this setup, each click of time represents therefore a contact and all nodes have the same number of contacts per unit time *c* = 1. More general situations can be simulated by allowing infectious nodes to attempt infecting several nodes at each time step. As in the turtle world, the infectious agent remains so in a time interval *t*_{r}, while the times *t*_{r}, *t*_{i} can be chosen different for each node by drawing samples of some previously chosen distribution.

In contrast with the turtle world, a general network breaks the assumption of full mixing, since two nodes that are not linked have exactly zero probability of transmiting the disease between them. On the other hand, a fully connected network, where each node is linked to the remaining *N* − 1 nodes, represents correctly a fully mixed situation. In this case the basic reproductive number *R*_{0} is simply
(4)

For a general network with small clustering, the correction to this relation is expected to scale as ∝ 1/〈*k*〉 as shown in Fig 1). More generally, the value of *R*_{0} can depend in a non-trivial way on the network topological properties.

In our study we will concentrate on a particular one-parameter family of random networks described by Klemm and Eguiluz (KE) [15]. These complex networks show a number of features that are expected in realistic networks:

**Scale-free**Nodes with both large and small number of contacts are present. In fact the distribution of the number of nodes is given by the power law (5)**Small-world**Most nodes are not linked between themselves (i.e. 〈*k*〉≪*N*), but every link can be reached from any other by a small number of hops. Being more specific, the average distance between nodes gros logarithmically with the size of the network 〈*d*〉∼log*N*.**High clustering**Even if two networks share the number of nodes, edges and the degree distribution, they can look very different if the average clustering coefficient, 〈*C*〉, is different. The clustering coefficient*c*_{i}of a node*n*_{i}measures the probability that two neighbors of*n*_{i}are also neighbours (6)

In Fig 2 we show two networks with equal distribution of*k*that differ only in the different clustering properties.

KE networks depend on a free parameter*μ*that does not affect the average degree of the network or its distribution, but affects severely the value of the clustering, interpolating from almost no clustering 〈*C*〉 = 0 for*μ*→ 1, to a very clustered network with 〈*C*〉≈0.84 for*μ*= 0.

## uSEIR formulation

A real epidemic is a complex stochastic process that eventually evolves to a regime where there are large numbers of individuals in the S-E-I-R compartments. In the assumption that the populations in these compartements are homogeneous and maximally mixed, the dynamics of the system should be well described in terms of the global variables *S*(*t*), *E*(*t*), *I*(*t*), *R*(*t*), whose time evolution is described by a set of deterministic differential equations [9, 16].

We first want to derive the set of equations that should describe the dynamics of these variables under the assumption that the incubation and removal times are fixed. The relation between the changes in these variables is essentially fixed by unitarity. On the one hand, each individual must be in one of the S, E, I or R compartments. Therefore the number of individuals in the population, *N*, is a constant:
(7)

Secondly, there must also be a relation between the rates at which these different individuals move from one compartment to the next. An infectious process is that in which an infected individual gets in contact with a susceptible one. Let us call *r*_{S → E} the rate of infection per unit time per infected individual and per susceptible individual. The number of susceptible individuals gets reduced by those that become exposed between [*t*, *t* + *dt*], that is:
(8)

The parameter *r*_{S → E} that governs the infection rate is often denoted as *β*/*N* in standard SEIR notation. This is the basic equation that assumes an homogenous and maximally-mixed susceptible and infectious populations, making the treatment of the microscopic process in terms of global variables possible. It constitutes the simplest possible form of the force of infection, defined as (minus) the logarithmic derivative of *S*. Keeping within the simplest approximation, if the incubation and removal times of all individuals have the same values, we must also have that the individuals that become exposed at time *t* are those that move from compartment *S* → *E* minus those that move from *E* → *I*. But the latter must be the ones that entered the exposed compartment in time *t* − *t*_{i}. Therefore we have:
(9)
where *θ* is the Heaviside step function.

The initial conditions to these equations start with a fixed *N* and a number of infected individuals at time *t* = 0, *I*(0) = *I*_{0}, so that *S*(0) = *S*_{0} = *N* − *I*_{0}, while *E*(0) = 0 and *R*(0) = 0. In the equations above, the number of initially infected individuals does not recover, but we can easily force this with the substitution in Eq (8):
(10)

These equations depend only on three variables, namely *r*_{S → E}, *t*_{i} and *t*_{r}, which in principle are the same parameters appearing in the classical SEIR models. In terms of the basic reproduction number, *R*_{0}, *r*_{S → E} corresponds to the combination:
(11)

Note that *R*_{0} is proportional to *t*_{r}, while *r*_{S → E} is independent of *t*_{r}. In a microscopic description of the infected process as in the ABM simulations, the rate is related to the microscopic parameters via *R*_{0} from Eq (1) or Eq (4) for the different ABMs.

We can compare the uSEIR and classical SEIR solutions to the ABMs simulations, matching the basic microscopic parameters. In Fig 3 we show the curve for the fraction of infected individuals as a function of time measured from 10 independent turtle simulations in a population of 10^{4} agents with a fraction of infectious agents of 10^{−3} at *t* = 0, and assuming fixed parameters *t*_{i}, *t*_{r} and *r*_{S → E} for all the agents. The uSEIR solution agrees very well with the simulations, while the classical SEIR predicts a wider and less pronounced peak.

The values of *R*_{0}, *t*_{i} and *t*_{r} are in the typical range of those used to describe the current COVID-19 pandemic.

This is of course not surprising, since classical SEIR is known to be valid when *t*_{i} and *t*_{r} are exponentially distributed, corresponding to an underlying Markovian stochastic process. Modifications of SEIR equations adding more compartments can be designed to represent Erlang distributions, that for sufficiently large *n* are narrower, but uSEIR gets the limit of fixed values of the parameters directly and without these complications.

In realistic cases, not all individuals have the same incubation or removal times, and certainly not all individuals have the same number of contacts and probability of infection per contact. In the following, we consider the effect of these different non-homogeneities.

## Generically distributed *t*_{i} and *t*_{r}

Non-trivial distributions for *t*_{i} and *t*_{r} can be incorporated in the uSEIR equations by considering different compartments of individuals. For example, the population divides into those with different incubation periods, , so we have *S*_{k}(*t*) as the susceptible individuals in the *k*-th compartment of incubation time. Each compartment follows its usual progression *S*_{k} → *E*_{k} → *I*_{k} → *R*_{k}, but the important point to notice is that a given susceptible individual in compartment *k* becomes an exposed individual in the same compartment *k*, but can get infected from any infectious individual in any other compartment. If we assume that the capability to infect per unit time is independent on the compartment, the number of susceptible individuals in compartment *k* changes as they become exposed according to:
(12)
while Eq (9) will still be valid for the exposed, infected and recovered in each compartment *k*, taking the incubation period as that corresponding to this compartment, *t*^{(k)}.

Summing over all the compartments, the first equation leads to: (13) while in the others we get (14)

Obviously in the limit of varying continuously the sum becomes an integral with the corresponding PDF, *P*_{E}(*t*_{i}):
(15)

We can similarly assume sub-compartments for varying *t*_{r}, with a PDF *P*_{I}(*t*_{r}), and the modification would be analogous, resulting in the following delay integro-differential equations:
(16)

We refer to Eqs (16) and (9) indistinctively as uSEIR.

A simple and efficient algorithm to solve these equations, complete with easy-to-use codes in Python and Julia, is described in S1 Appendix.

### Recovering classical SEIR

In the case where the probabilities are exponential, the integro-differential equations can be reduced to regular differential ones, of the classical SEIR type.

Let us assume (17) and define (18)

The derivative of this function is related to that of *E*(*t*), using Eq (14),
(19)
so up to a constant
(20)

Since *f*(0) = *E*(0) = 0, the constant must vanish and the equations reduce to:
(21)

Analogously we define
(22)
which for an exponential with average 〈*t*_{r}〉 satisfies
(23)
and therefore
(24)
where *C*′ = −*I*(0)/〈*t*_{r}〉. Finally, the integral in the first equation:
(25)

Finally, defining (26) we recover the classical SEIR equations: (27)

We can incorporate easily the exponential distributions for *t*_{i} and *t*_{r} in the ABMs simulations, while we maintain the rate of infection constant. The comparison of the SEIR solution of Eq (27) and the homogeneous ABM simulation with exponentially distributed *t*_{i} and *t*_{r} is shown in Fig 4. The agreement as expected is good, even if the variance is much larger than in the fixed-parameters case. In fact, an interesting observation is that most of the observed variance of the outbreaks is a simple time translation. If we time-translate all the outbreaks to make their maxima coincide the variance is much smaller and the agreement with SEIR better, see Fig 5. We will discuss the origin of this time-shift in the following section.

An exponential distribution for the incubation and removal times is however not realistic. A more realistic distribution seems to be, e.g., a general gamma distribution, Γ[*k*, *θ*]. For the COVID-19 epidemic, the distribution of incubation times has been shown to be well described with a gamma with parameters (*k*, *θ*)≃(5.8, 0.948) [7], corresponding to an average 〈*t*_{i}〉≃5.5 days. For the removal time, we assume the same distribution with parameters (6.5, 1). This corresponds to the average between the “short” and “long” removal times discussed in [7].

We compare the results of the gamma-distributed ABM simulations in Fig 6. As expected, classical SEIR does not give a good description of the simulations in this case, while solving the integro-differential Eq (14) does.

The simulations have been time-shifted so that their maxima coincide. The simulation has parameters in both cases *N* = 10^{4} and *I*(0) = 10 with *R*_{0} = 3.5, 〈*t*_{i}〉 = 5.5 days and 〈*t*_{r}〉 = 6.5 days.

We note that, although there is a vast literature on incorporating arbitrary distributions for *t*_{i} and *t*_{r} in stochastic approaches to the propagation of epidemics (see, e.g., a recent review in [8]), we have not found a simple formulation of the problem in the context of compartmental models such as the one described by equations Eq (16). While generalizations of exponential distributions, such as the Erlang case, are dealt with in the standard SEIR literature using a superficially similar sub-compartmentation approach (see, e.g., [17–21]) this is not quite as general as the treatment described here.

## Non-uniform infection rate and universality

A different situation is when the rate of infection is non-uniform across the population. It is important to stress that the rate depends on two independent parameters: the number of contacts per infected individual, which critically depends on the clustering properties of the social network, and the probability of infection per contact. Non-uniformity can originate in either of the two properties. In this section we will consider the simplest case of a uniform number of contacts, but a non-uniform infection probability per contact.

### Non-uniform rate: The probability of infection

We could separate the population in individuals that infect others with different rates. The rate might depend on the type of infectious individual and the type of susceptible individual. Defining to be the rate at which an infected individual of type *l* infects a susceptible individual of type *k*. The equations in this case are:
where *t*_{i} and *t*_{r} might also depend on the compartment.

Assuming that the rates only depend on the type of infecting individual and not on the type of susceptible and, for simplicity, that *t*_{i} and *t*_{r} are fixed, only the total number of individuals in each compartment needs to be evolved. This is the case, because the different compartments are in some proportion in the population and we assume the proportion is preserved by the initial conditions of the *I*_{k}(0) and *S*_{k}(0). The equations reduce to the usual ones with a rate that is the weighted average:
(28)
where *p*^{k} is the proportion of individuals in compartment *k*. In the continuous case
(29)
where *P*_{R}(*r*) is the corresponding PDF.

However, this result seems in conflict with the fact non-uniformity in the rate is known to be very important in the evolution of an epidemic (see, e.g., [22, 23]). One example of this is the relevance of the fraction of individuals for which the probability of infection is zero. Their presence in a given population implies that the effective number of useful contacts gets reduced. When the fraction of the population with zero infecting power is large enough the epidemic may be aborted. In practice, the effect is similar to that of herd immunity, used to measure the needed number of vaccinations to abort an epidemic. A very rough estimate for the fraction of herd immunity, *f*_{H}, would be
(30)

For example, with *R*_{0} ∼ 3, *f*_{H} ∼ 0.7, that is 70% of the population. One would then naively expect that in an epidemic where this estimate holds about 70% of the population ends up getting infected; however, in the previous examples a larger fraction is found. The reason for this overshooting effect is that, due to the time delay in the process, the fraction of recovered individuals grows slowly and is not effective in reducing the growth of the epidemic sufficiently, as would be the case if the fraction of immune individuals had been present from the start, as would be the case, for instance, in a (partially) vaccinated population. Note that in the SEIR paradigm, the immune population is part of the susceptible, that pass by the compartments *E* → *I* → *R* but have zero infecting power when they are *I* so they are inert. In practice the evolution of the epidemic would be identical if we just dropped them from the start and readjust the rate not to include them.

It has been argued that for COVID-19 the distribution of *R*_{0} across the population is well described by the negative binomial distribution, NB[0.16, 0.0437] [24], which has average 3.5 but a large dispersion. This distribution implies that about 60% of the population is immune (not far from the naive herd immunity), while there must be few individuals that have a very large rate of infection, the famous superspreaders.

In Fig 7 shows the evolution of 100 simulations assuming fixed *t*_{i} and *t*_{r} while *R*_{0} is drawn from this negative binomial. The average of those outbreaks as well as the result of uSEIR using the average 〈*R*_{0}〉 are also shown. Clearly the variance is huge, and the average is not a good representation of the individual epidemic histories. The uSEIR curve misses completely the outliers.

The average of those histories is the red curve. The simulation has parameters *N* = 2 × 10^{4} and *I*(0) = 10 with 〈*R*_{0}〉 = 3.5, *t*_{i} = 5.5 days and *t*_{r} = 6.5 days. This is compared to uSEIR (black).

There is an interesting observation however. If all the curves are time-translated to make their maxima coincide, they fall in the uSEIR curve, as shown on the right Fig 8.

This fact can be interpreted as follows. The position of the peak is non-universal, because it depends very sensitively on the initial conditions, in particular on what is the infectious potential of the first infectious agents. Since all epidemics start with a small number of individuals, we cannot invoke the central limit theorem for the initial stages of an outbreak. These stages have a large variability, however as the exponential grows the averaging effect of the population starts to be effective. The curve around the maximum is in fact universal, in the sense that it depends on the average of the basic parameters and not on the initial conditions, as we now show from the uSEIR equations.

### Universality and the logistic curve

We have observed that the main effect of the different initial conditions is a temporal shift of the maximum, but the shape or the height of the infection curve does not change significantly. This strongly suggest that the equations have a universal solution. We have indeed found it. Let us consider the differential Eq (9) near the maximum of the infection curve *t*_{max}, which will remain as a free parameter. Let us also assume that *t*_{max} ≫ *t*_{i}, *t*_{r}, and define the function
(31)

The differential equations for the uSEIR with fixed *t*_{i} and *t*_{r} and for *t* ≫ *t*_{i}, *t*_{r}:
(32)
which implies
(33)

Since *I*(*t*)→0, *E*(*t*)→0, *F*(*t*) = *S*(*t*)*I*(*t*)→0 as *t* → ∞, it follows that *C*′ = 0, *C*′′ = 0 and *C* = *N*. Using the previous equations, it is easy to derive a differential equation for *F*(*t*), expanding at linear order in *t*_{i} and *t*_{r}:
(34)

We are interested in the solution near the maximum, so we use the initial conditions: (35)

This non-linear equation has an analytical solution given by: (36) with (37)

This is the universal function that drives the evolution of the infected, exposed and susceptible+recovered individuals near the maximum. The maximum of the infected is at *t*_{max} − *t*_{i} for the infected, while the maximum(minimum) for the exposed (susceptible+recovered) is at *t*_{max}. The integral of this function from [−∞, ∞] is
(38)

Note that for large *t*_{max}, the range *t* < 0 gives a negligible contribution. We can also derive the value of the susceptible at *t*_{max} since
(39)
and the curve of the susceptible can be easily obtained
(40)

The total number of susceptible at the end of the epidemic is therefore: (41)

With this we conclude that the epidemic curve is universal once the value of the maximum position is determined. The value of *F*_{0} should also depend on the basic parameters and not the initial conditions, although the precise value is not easy to get. A rough estimate can be obtained as follows. Near the maximum, and if the incubation and removal times are sufficiently small, we can approximate that *R*(*t*_{max}) ≃ *I*(*t*_{max}) + *E*(*t*_{max}), since the infected and exposed quickly recover; using this and the value of *S*(*t*_{max}) we can estimate *F*_{0} to be
(42)

The only dependence on the initial condition remains in *t*_{max}. In Fig 9 we compare the numerical solution to the uSEIR equations to the analytic expression of Eq (36), fixing the parameters *F*_{0} and *t*_{max} (the height and the position of the peak) from the numerical solution. Varying the initial conditions, that is the fraction of the number of infected individuals at *t* = 0, shifts *t*_{max}, but otherwise leaves the curve invariant. As can be seen, the analytical solution around the peak describes very well the full uSEIR solution. The agreement is better for smaller values of *t*_{i} and *t*_{r}.

The two pairs of solid curves correspond to a fraction of infected individuals of 10^{−3} and 5 ⋅ 10^{−4}. The two dashed lines are the same function shifted in time.

It is possible to extend this asymptotic solution to the case where *t*_{i} and *t*_{r} are not fixed but drown from distributions *P*_{E}(*t*_{i}) and *P*_{I}(*t*_{r}). Eq (34) gets modified in that the coefficient of the last term becomes:
(43)
where 〈〉 refers to the average with the corresponding PDF. Therefore the logistic, Eq (36), is still the asymptotic solution with a modified parameter:
(44)

## Non-uniform rate in network simulations

We now consider the non-homogeneities in the social contacts. We have generated a number of KE networks with 〈*k*〉 = 40 and different clustering properties, by changing the *μ* parameter. The networks have 10^{6} nodes. On these networks we evolve the epidemic using the time progression explained above, starting with 10 infected nodes. The probability of infection per contact is *p* = 2 × 10^{−3}. For the incubation and removal times we assume a LogNormal distributions, in units of the step time, *ϵ*, with parameters (*μ*_{X}, *σ*_{X}) = (10^{3}, 200) for *t*_{r} and (*μ*_{X}, *σ*_{X}) = (500, 100) for *t*_{i}, where *μ*_{X} is the mean and is the variance. For these parameters, *p*〈*t*_{r}〉 = 2, which gives an approximation to *R*_{0} up to 1/〈*k*〉 corrections, as explained in sec. 1. From Fig 1, we can get a more precise estimate of *R*_{0} = . For each network we run a number of simulations and average the S-E-I-R fractions, after performing a time-shift to make their maxima coincide (which as in previous cases, reduces most of the variance). In Fig 10 we show the evolution of infected individuals as a function of time for the various networks. We observe a clear dependence on the clustering parameter, but nevertheless the data in all cases is extremely well described by the universal behaviour derived from uSEIR, Eq (36). The lines are three-parameter fits (*a*, *I*_{0}, *t*_{max}) of the form:
(45)
uSEIR predicts, according to Eqs (36) and (44) and Fig 1,
(46)
while
(47)
and using the rough estimate of Eq (42), we get *I*_{0}/*N* ∼ 1/6. Both parameters would therefore be given in terms of the average microscopic parameters.

The ER network shows the result on an Erdős-Rényi random network [25] with 〈*k*〉 = 40 and zero clustering. The lines going through the data are fits to Eq (36), leaving *a*, *I*_{0} and as free parameters.

In Fig 11 we show the dependence of and *I*_{0}/*N*, on the average local clustering 〈*C*〉. For small clustering we observe that is roughly constant and matches rather well the microdynamical average value of Eq (37). Instead *I*_{0}/*N* decreases with clustering, even for small clustering. This effect can be interpreted as effective suppression of the fraction of susceptible population: clustering seems to screen the access to the susceptible. Note that if we substitute in the uSEIR equations *S* by *f*_{c} *S*, where *f*_{c} is the screening factor, the asymptotic solution is as in Eq (45) with *I*_{0} → *f*_{c} *I*_{0}, while remains invariant. This could explain the behaviour found at small clustering.

Dashed lines are intended to guide the eye through the data points.

At large clustering, on the other hand, the parameters *I*_{0} and *a* show a non-trivial dependence with clustering. In spite of this, the logistic remains an extremely good description of the time evolution of the infected fraction. It would be interesting to understand this behaviour in terms of a renormalization or screening of the basic parameters, or modifications of the force of infection with respect to the well-mixed approximation yielding −*S*′/*S* ∝ *I*.

As a final comment, we note that everything we have studied here assumes no time variation of the basic parameters. In a real epidemic, measures of social distancing, self-protection, etc. are taken, that induce a sudden change of the basic parameters, particularly the rate of infection. This effect induces a quench of the epidemic curves that we have been discussing in this paper. It will be interesting to explore to what extent the evolution after the quenches can be understood in terms of the fundamental parameters, in particular whether the universality near the herd-peak translates into some universality of the curve after a quench, if it has happened in the asymptotic regime.

## Conclusions

In this paper we have presented a simple formulation, uSEIR, Eq (16) of the SEIR modelization of a epidemic outbreak that properly accounts for an arbitrary distribution of incubation and removal times, reducing to classical SEIR in the limit of distributions of the exponential family. We have compared this model with a series of ABM homogeneous simulations for various scenarios including fixed values for the incubation and removal times, as well as various realistic distributions for the the latter, or for the probability of infection per contact. We have also considered ABM simulations on scale-free networks with varying clustering properties. In all cases, the model reproduced the simulations accurately after a non-universal time-shift. Only in the presence of large local clustering in the distribution of contacts we observed a clear deviation, when the averages of microdynamical parameters are included. The uSEIR formulation allowed us to understand the universality property observed in different outbreaks in the simulations. This derives from an explicit asymptotic solution found for small incubation and removal times in terms of a logistic curve, with a shape that can be determined in terms of the microdynamical parameters. This curve is found to fit very well the data even in cases of large clustering, provided the parameters are left as free fit parameters, suggesting that the dynamics in the high clustering regime may still be well described in terms of global variables but with screened or renormalized parameters. On the contrary, the early stages of an outbreak are highly non universal, an aspect that should be carefully taken into account when fitting data and predicting using any SEIR modelling. Only when the early stages of exponential growth are well underway, is uSEIR expected to be a good description. The averaging of independent outbreaks, without taking into account the non-universal time-shift, can also be very misleading.

## References

- 1.
See for example, the CMMID repository, https://cmmid.github.io/topics/covid19/.
- 2. Tang B, Wang X, Li Q, Bragazzi NL, Tang S, Xiao Y, et al. Estimation of the Transmission Risk of the 2019-nCoV and Its Implication for Public Health Interventions. J Clin Med. 2020; 9: 462. pmid:32046137
- 3. Lin Q, et al. A conceptual model for the coronavirus disease 2019 (COVID-19) outbreak in Wuhan, China with individual reaction and governmental action. International Journal of Infectious Diseases. 2020; 93: 211. pmid:32145465
- 4.
López L, Rodó X. A modified SEIR model to predict the COVID-19 outbreak in Spain and Italy: simulating control scenarios and multiscale epidemics 2020. https://doi.org/101101/2020032720045005
- 5. Hethcote HW. The Mathematics of Infectious Diseases. SIAM Review. 2000; Vol 42, No 4, pp 599–653.
- 6. Zhang J, et al. Evolving epidemiology and transmission dynamics of coronavirus disease 2019 outside Hubei province, China: a descriptive and modelling study. Lancet Infect. Dis. 2020; Vol. 20, 7, 793–802. pmid:32247326
- 7. Hellewell J, et al. Feasibility of controlling COVID-19 outbreaks by isolation of cases and contacts. Lancet Glob. Health. 2020; Vol. 8, 4, E488–E496. pmid:32119825
- 8.
Britton T, Pardoux EE. Stochastic Epidemic Models with Inference. vol. 2255 of Mathematical Biosciences Subseries. Springer; 2019.
- 9. Kermack WO, McKendrick AG. Contributions to the mathematical theory of epidemics, part 1. Proc. Roy. Soc. London Ser A, 1927; 115, 700–721.
- 10. Hunter E, Mac Namee B, Kelleher J. A Taxonomy for Agent-Based Models in Human Infectious Disease Epidemiology. Journal of Artificial Societies and Social Simulation. 2017; 20(3) 2.
- 11.
https://github.com/projectmesa/mesa.
- 12.
http://ccl.northwestern.edu/netlogo/index.shtml.
- 13. Watts DJ, Strogatz SH. Collective dynamics of’small-world’ networks. Nature. 1998;393(6684):440–442. pmid:9623998
- 14. Pastor-Satorras R, Castellano C, Van Mieghem P, Vespignani A. Epidemic processes in complex networks. Reviews of Modern Physics. 2015;87(3):925–979.
- 15. Klemm K, Eguíluz V. Growing scale-free networks with small-world behavior. Physical Review E. 2002;65(5). pmid:12059755
- 16.
Anderson RM, May RM. Infectious Diseases of Humans: Dynamics and Control. Dynamics and Control. OUP Oxford; 1992. Available from: https://books.google.es/books?id=HT0--xXBguQC.
- 17. Lloyd AL. Realistic Distributions of Infectious Periods in Epidemic Models: Changing Patterns of Persistence and Dynamics. Theoretical Population Biology. 2001;60(1):59–71. pmid:11589638
- 18. Lloyd AL. Destabilization of epidemic models with the inclusion of realistic distributions of infectious periods. Proceedings of the Royal Society of London Series B: Biological Sciences. 2001;268(1470):985–993. pmid:11370974
- 19. Wearing HJ, Rohani P, Keeling MJ. Appropriate Models for the Management of Infectious Diseases. PLoS Medicine. 2005;2(7):e174. pmid:16013892
- 20. Conlan AJK, Rohani P, Lloyd AL, Keeling M, Grenfell BT. Resolving the impact of waiting time distributions on the persistence of measles. Journal of The Royal Society Interface. 2009;7(45):623–640. pmid:19793743
- 21. Krylova O, Earn DJD. Effects of the infectious period distribution on predicted transitions in childhood disease dynamics. Journal of The Royal Society Interface. 2013;10(84):20130098. pmid:23676892
- 22. Keeling MJ, Eames KTD. Networks and epidemic models. Journal of The Royal Society Interface. 2005;2(4):295–307. pmid:16849187
- 23. Bansal S, Grenfell BT, Meyers LA. When individual behaviour matters: homogeneous and network models in epidemiology. Journal of The Royal Society Interface. 2007;4(16):879–891. pmid:17640863
- 24. Lloyd-Smith JO, Schreiber SJ, Kopp PE, Getz WM. Superspreading and the effect of individual variation on disease emergence. Nature. 2005; Vol 438, 355–359. pmid:16292310
- 25. Erdős P and Rényi A. On random graphs. Publicationes Mathematicae. 1959;6:290–297.