Solution (source code)

= Solution

While $I>0$, divide the susceptible equation by the recovered equation:
$$
\frac{dS}{dR}=-\frac{\beta}{Nq_{IR}}S.
$$
Taking $R(0)=0$ and integrating gives
$$
S(t)=S_0\exp\!\left[-\frac{\beta}{Nq_{IR}}R(t)\right].
$$
At the end of the epidemic $E_\infty=I_\infty=0$, so conservation gives $R_\infty=N-S_\infty$. Defining
$$
\mathcal R=\frac{\beta}{Nq_{IR}},
$$
we obtain the <final size relation for an epidemic>
$$
S_\infty=S_0\exp[-\mathcal R(N-S_\infty)].
$$