Miller 2012 shows that the final size of an epidmic for a well-mixed population can be derived in the following way. We divide the population into susceptible, infected, and recovered fractions: \(S(t), I(t), and R(t)\) respectively. Assuming a large population, constant transmission and recovery rates, and mass action mixing, we have
\[\dot{S}= -\beta IS, ~\dot{I}=\beta IS -\gamma I, ~\dot{R}=\gamma I\] We can remove \(\dot{R}\) since \(S+I+R=1\). From the equation, we can have the following relationship.
We can find \(C=1\) using the initial conditions (\(I\rightarrow 0, S\rightarrow 0\)). Then, using \(I(\infty)=0\) gives the following relationship
\[S(\infty) = 1 − \text{exp}\left[-R_0\left(1-S(\infty)\right)\right]\] Using the \(R(\infty)=1-S(\infty)\), we can get the following equation for the final size of an epidemic, \(R(\infty)\):
\[R(\infty) = 1 − \text{exp}\left[-R_0R(\infty)\right]\] Let’s use the above relationship to compute the final epidemic size nuerically
final_size <-function(R, R0){ R -1+exp(-R0*R)}# lower bound set at 0.1 to avoid R=0, which is also a solutionuniroot(final_size, interval=c(0.1,1), R0=2)$root
Instead of uniroot, optimize function can be used to find the solution for the above equation. However, optimize gives the correct answer when the function was squared.