compartmental models in epidemiology compartmental models in epidemiology compartmental models are a very general modelling technique. they are often applied to the mathematical modelling of infectious diseases. the population is assigned to compartments with labels – for example, s, i, or r, (susceptible, infectious, or recovered). people may progress between compartments. the order of the labels usually shows the flow patterns between the compartments; for example seis means susceptible, exposed, infectious, then susceptible again. the origin of such models is the early 20th century, with important works being that of ross in 1916, ross and hudson in 1917, kermack and mckendrick in 1927 and kendall in 1956. the reed-frost model was also a significant and widely-overlooked ancestor of modern epidemiological modelling approaches. the models are most often run with ordinary differential equations (which are deterministic), but can also be used with a stochastic (random) framework, which is more realistic but much more complicated to analyze. models try to predict things such as how a disease spreads, or the total number infected, or the duration of an epidemic, and to estimate various epidemiological parameters such as the reproductive number. such models can show how different public health interventions may affect the outcome of the epidemic, e.g., what the most efficient technique is for issuing a limited number of vaccines in a given population. the sir model the sir model is one of the simplest compartmental models, and many models are derivatives of this basic form. the model consists of three compartments: s: the number of susceptible individuals. when a susceptible and an infectious individual come into "infectious contact", the susceptible individual contracts the disease and transitions to the infectious compartment. i: the number of infectious individuals. these are individuals who have been infected and are capable of infecting susceptible individuals. r for the number of removed (and immune) or deceased individuals. these are individuals who have been infected and have either recovered from the disease and entered the removed compartment, or died. it is assumed that the number of deaths is negligible with respect to the total population. this compartment may also be called "recovered" or "resistant". this model is reasonably predictive for infectious diseases that are transmitted from human to human, and where recovery confers lasting resistance, such as measles, mumps and rubella. spatial sir model simulation. each cell can infect its eight immediate neighbors. these variables (s, i, and r) represent the number of people in each compartment at a particular time. to represent that the number of susceptible, infectious and removed individuals may vary over time (even if the total population size remains constant), we make the precise numbers a function of t (time): s(t), i(t) and r(t). for a specific disease in a specific population, these functions may be worked out in order to predict possible outbreaks and bring them under control. as implied by the variable function of t, the model is dynamic in that the numbers in each compartment may fluctuate over time. the importance of this dynamic aspect is most obvious in an endemic disease with a short infectious period, such as measles in the uk prior to the introduction of a vaccine in 1968. such diseases tend to occur in cycles of outbreaks due to the variation in number of susceptibles (s(t)) over time. during an epidemic, the number of susceptible individuals falls rapidly as more of them are infected and thus enter the infectious and removed compartments. the disease cannot break out again until the number of susceptibles has built back up, e.g. as a result of offspring being born into the susceptible compartment. yellow=susceptible, maroon=infectious, teal=recovered each member of the population typically progresses from susceptible to infectious to recovered. this can be shown as a flow diagram in which the boxes represent the different compartments and the arrows the transition between compartments, i.e. states in an sir epidemic model and the rates at which individuals transition between them transition rates for the full specification of the model, the arrows should be labeled with the transition rates between compartments. between s and i, the transition rate is assumed to be d(s/n)/dt = -βsi/n2, where n is the total population, β is the average number of contacts per person per time, multiplied by the probability of disease transmission in a contact between a susceptible and an infectious subject, and si/n2 is the fraction of those contacts between an infectious and susceptible individual which result in the susceptible person becoming infected. (this is mathematically similar to the law of mass action in chemistry in which random collisions between molecules result in a chemical reaction and the fractional rate is proportional to the concentration of the two reactants). between i and r, the transition rate is assumed to be proportional to the number of infectious individuals which is γi. this is equivalent to assuming that the probability of an infectious individual recovering in any time interval dt is simply γdt. if an individual is infectious for an average time period d, then γ = 1/d. this is also equivalent to the assumption that the length of time spent by an individual in the infectious state is a random variable with an exponential distribution. the "classical" sir model may be modified by using more complex and realistic distributions for the i-r transition rate (e.g. the erlang distribution). for the special case in which there is no removal from the infectious compartment (γ=0), the sir model reduces to a very simple si model, which has a logistic solution, in which every individual eventually becomes infected. the sir model without birth and death a single realization of the sir epidemic as produced with an implementation of the gillespie algorithm and the numerical solution of the ordinary differential equation system (dashed). the dynamics of an epidemic, for example, the flu, are often much faster than the dynamics of birth and death, therefore, birth and death are often omitted in simple compartmental models. the sir system without so-called vital dynamics (birth and death, sometimes called demography) described above can be expressed by the following system of ordinary differential equations: { d s d t = − β i s n , d i d t = β i s n − γ i , d r d t = γ i , &=-,\\&=-\gamma i,\\&=\gamma i,\end\right.} the sir model. where s is the stock of susceptible population, i is the stock of infected, r is the stock of removed population (either by death or recovery), and n is the sum of these three. this model was for the first time proposed by william ogilvy kermack and anderson gray mckendrick as a special case of what we now call kermack–mckendrick theory, and followed work mckendrick had done with ronald ross. this system is non-linear, however it is possible to derive its analytic solution in implicit form. firstly note that from: d s d t + d i d t + d r d t = 0 , ++=0,} it follows that: s ( t ) + i ( t ) + r ( t ) = constant = n , =n,} expressing in mathematical terms the constancy of population n . note that the above relationship implies that one need only study the equation for two of the three variables. secondly, we note that the dynamics of the infectious class depends on the following ratio: r 0 = β γ , =,} the so-called basic reproduction number (also called basic reproduction ratio). this ratio is derived as the expected number of new infections (these new infections are sometimes called secondary infections) from a single infection in a population where all subjects are susceptible. this idea can probably be more readily seen if we say that the typical time between contacts is t c = β − 1 =\beta ^ , and the typical time until removal is t r = γ − 1 =\gamma ^ . from here it follows that, on average, the number of contacts by an infectious individual with others before the infectious has been removed is: t r / t c . /t_.} by dividing the first differential equation by the third, separating the variables and integrating we get s ( t ) = s ( 0 ) e − r 0 ( r ( t ) − r ( 0 ) ) / n , (r(t)-r(0))/n},} where s ( 0 ) and r ( 0 ) are the initial numbers of, respectively, susceptible and removed subjects. writing s 0 = s ( 0 ) / n =s(0)/n} for the initial proportion of susceptible individuals, and s ∞ = s ( ∞ ) / n =s(\infty )/n} and r ∞ = r ( ∞ ) / n =r(\infty )/n} for the proportion of susceptible and removed individuals respectively in the limit t → ∞ , one has s ∞ = 1 − r ∞ = s 0 e − r 0 ( r ∞ − r 0 ) =1-r_=s_e^(r_-r_)}} (note that the infectious compartment empties in this limit). this transcendental equation has a solution in terms of the lambert w function, namely s ∞ = 1 − r ∞ = − r 0 − 1 w ( − s 0 r 0 e − r 0 ( 1 − r 0 ) ) . =1-r_=-r_^\,w(-s_r_e^(1-r_)}).} this shows that at the end of an epidemic that conforms to the simple assumptions of the sir model, unless s 0 = 0 =0} , not all individuals of the population have been removed, so some must remain susceptible. a driving force leading to the end of an epidemic is a decline in the number of infectious individuals. the epidemic does not typically end because of a complete lack of susceptible individuals. the role of both the basic reproduction number and the initial susceptibility are extremely important. in fact, upon rewriting the equation for infectious individuals as follows: d i d t = ( r 0 s n − 1 ) γ i , =\left(r_-1\right)\gamma i,} it yields that if: r 0 ⋅ s ( 0 ) > n , \cdot s(0)>n,} then: d i d t ( 0 ) > 0 , (0)>0,} i.e., there will be a proper epidemic outbreak with an increase of the number of the infectious (which can reach a considerable fraction of the population). on the contrary, if r 0 ⋅ s ( 0 ) < n , \cdot s(0)<n,} then d i d t ( 0 ) < 0 , (0)<0,} i.e., independently from the initial size of the susceptible population the disease can never cause a proper epidemic outbreak. as a consequence, it is clear that both the basic reproduction number and the initial susceptibility are extremely important. the force of infection note that in the above model the function: f = β i , models the transition rate from the compartment of susceptible individuals to the compartment of infectious individuals, so that it is called the force of infection. however, for large classes of communicable diseases it is more realistic to consider a force of infection that does not depend on the absolute number of infectious subjects, but on their fraction (with respect to the total constant population n ): f = β i n . .} capasso and, afterwards, other authors have proposed nonlinear forces of infection to model more realistically the contagion process. exact analytical solutions to the sir model in 2014, harko and coauthors derived an exact so-called analytical solution (involving an integral that can only be calculated numerically) to the sir model. in the case without vital dynamics setup, for s ( u ) = s ( t ) (u)=s(t)} , etc., it corresponds to the following time parametrization s ( u ) = s ( 0 ) u (u)=s(0)u} i ( u ) = n − r ( u ) − s ( u ) (u)=n-(u)-(u)} r ( u ) = r ( 0 ) − ρ ln ⁡ ( u ) (u)=r(0)-\rho \ln(u)} for t = n β ∫ u 1 d u ∗ u ∗ i ( u ∗ ) , ρ = γ n β , \int _^(u^)}},\quad \rho =,} with initial conditions ( s ( 1 ) , i ( 1 )