SIR model equations (source code)

= SIR model equations
{c}
{title2=$\dot s=-\beta si,\quad\dot i=\beta si-\gamma i,\quad\dot r=\gamma i$}

For <frequency-dependent transmission>, the closed <SIR model> is a system of <ordinary differential equations> for the <fractions> $s,i,r$:
$$
\frac{ds}{dt}=-\beta si,\qquad
\frac{di}{dt}=\beta si-\gamma i,\qquad
\frac{dr}{dt}=\gamma i,
\qquad s+i+r=1.
$$
Here $\beta>0$ is the coefficient of <frequency-dependent transmission>, and $\gamma>0$ is the <recovery rate>, interpreted more generally as the removal rate. Both have units of inverse time. With a constant <recovery rate>, the associated individual time in the <infectious compartment> has an <exponential distribution> with <mean> $1/\gamma$; the <SIR model> does not require every person to spend exactly that long there. The <fractions> themselves have no units.https://ocw.mit.edu/courses/1-022-introduction-to-network-models-fall-2018/fe3c864fd7d2d45ed7fe65e601d9c69e_MIT1_022F18_lec20.pdf[MIT Lecture 20, slide 24: fraction equations]{ref}

For counts $S=Ns$, $I=Ni$, $R=Nr$, the same <SIR model equations> read
$$
\frac{dS}{dt}=-\beta\frac{SI}{N},\qquad
\frac{dI}{dt}=\beta\frac{SI}{N}-\gamma I,\qquad
\frac{dR}{dt}=\gamma I,
\qquad S+I+R=N.
$$
The factor $1/N$ keeps the same $\beta$ in both descriptions. Dropping it while keeping these units would fail <dimensional analysis>. Some existing <SIR model> variants use the unnormalized <mass-action infection> convention instead, including the <SIR susceptible-recovered identity>; their coefficient is $b=\beta/N$ in the notation used here.

Adding the <SIR model equations> gives $d(s+i+r)/dt=0$, a short proof of <conservation of population>. Nonnegative starting <fractions> stay nonnegative: the outflow from either the <susceptible compartment> or the <infectious compartment> vanishes when that group is empty, while $dr/dt\geq0$. Thus the <susceptible compartment> can only shrink and the <removed compartment> can only grow.

For a concrete <initial value problem>, stipulate
$$
\beta=0.3\,\mathrm{day}^{-1},\qquad
\gamma=0.1\,\mathrm{day}^{-1},\qquad
(s_0,i_0,r_0)=(0.99,0.01,0).
$$
At the start, the flow into the <infectious compartment> is $0.3\times0.99\times0.01=0.00297$ of the total per day, and the flow into the <removed compartment> is $0.1\times0.01=0.00100$ of the total per day. Hence $di/dt=0.00197$ per day. If $N=1000$, these correspond to model rates of $2.97$ and $1.00$ people per day, and net growth $1.97$ people per day. A rate need not be an integer count of events on any particular day.

For this <SIR model>, the <basic reproduction number> is
$$
R_0=\frac{\beta}{\gamma}=3.
$$
It describes one introduced member of the <infectious compartment> in an otherwise wholly <susceptible compartment>. The <instantaneous reproduction number> at the actual starting state is $R_0s_0=2.97$, obtained by freezing the current conditions and the current <susceptible compartment>'s <fraction>. More generally it is $R_0s(t)$ in this <SIR model>. The <basic reproduction number> is a ratio of two rates, so it has no units; $r_0$ is a different quantity, the initial <removed compartment>'s <fraction>.

While $i>0$, its instantaneous relative growth is
$$
\frac{1}{i}\frac{di}{dt}=\beta s-\gamma.
$$
Initially this equals $0.3\times0.99-0.1=0.197\,\mathrm{day}^{-1}$. Freezing $s\approx s_0$ gives the early <exponential growth> approximation $i(t)\approx0.01e^{0.197t}$ with $t$ measured in days. It must fail as the <susceptible compartment> shrinks. An <epidemic invasion threshold> occurs at $R_0s_0=1$; if $i_0=0$, the deterministic <SIR model> stays at $i=0$ even above that threshold.