Compartmental models (epidemiology) (source code)

= Compartmental models
{disambiguate=epidemiology}
{wiki}

= Compartmental model
{synonym}

<Compartmental models (epidemiology)> divide a <biological population> into states and specify transfers between them. A <compartment> might contain <susceptible individuals>, <infective individuals> or recovered individuals. The model must state what a compartment represents and whether its variable is a count or a fraction.

For a closed, homogeneously mixed <SIR model>, let $N=S+I+R$ and use <force of infection> $\beta I/N$ and <recovery rate> $\gamma$. Then
$$
\dot S=-\beta SI/N,\qquad
\dot I=\beta SI/N-\gamma I,\qquad
\dot R=\gamma I.
$$
Every transfer leaves one compartment and enters another, so summing the equations gives $\dot N=0$. This <conservation of population> follows from the specified closed model; demographic gains, deaths or external arrivals can change the total. An <SEIR model> adds an exposed state to distinguish infection from the ability to transmit.

A deterministic <ordinary differential equation> describes continuous compartment sizes. A <stochastic epidemic model> instead treats infection and recovery as random events between integer states. The latter can exhibit <epidemic extinction> even when the corresponding deterministic trajectory initially grows.