Basic reproduction number from the final attack rate of a completed epidemic

In the simple susceptible, infectious and recovered model, the final attack rate z of an epidemic satisfies the final size relation z = s_0(1 minus exp(minus R_0 z)), where s_0 is 1 when almost everyone is susceptible at the start. Taking logarithms of 1 minus z/s_0 = exp(minus R_0 z) rearranges the relation to give R_0 from an observed final attack rate. The function log is the natural logarithm.

Signature

R_0 = -log(1 - z / s_0) / z
Inputs
InputsDefinitionUnit
zProportion of the whole population infected over the completed epidemic, counting all infections, above zero and below s_0proportion
s_0Proportion of the population susceptible at the start of the epidemic, 1 when no one is immuneproportion
Output
R_0Expected number of further infections one case produces in a completely susceptible populationcases per case

Function

Attack rate, secondary attack rate and final epidemic size function

Maps counts of new cases and of people at risk over a stated period to an attack rate, a risk expressed as a proportion rather than a rate per unit of time. The same structure gives the secondary attack rate among contacts of primary cases, and comparing attack rates between groups gives the attack rate ratio and vaccine efficacy or effectiveness. Under the assumptions of the simple susceptible, infectious and recovered model, the final attack rate of a completed epidemic is linked to the basic reproduction number R_0 through the final size relation. In an economic evaluation the attack rate is either a fixed input probability of infection, as in a static model, or an output that changes with the intervention, as in a dynamic transmission model.

Computational function

  • Computational function: final attack rate by iteration and infections averted by pre-epidemic vaccination

    Takes the inputs of a vaccination scenario, a basic reproduction number, the coverage reached before the epidemic, the population size and the cost per person vaccinated, and returns the final attack rate with and without the programme, the infections averted and the cost per infection averted. The final size relation has z on both sides and cannot be rearranged to give z directly, so the function solves it by fixed-point iteration: starting from z = s_0, it repeats the update z = s_0(1 minus exp(minus R_0 z)), which falls steadily to the positive solution whenever R_0 s_0 exceeds 1. The inputs therefore differ from those of HE-FM-ATR-005, which runs the other way, from an observed final attack rate to R_0.

    Inputs and outputs: R_0: Basic reproduction number of the infection; required, above zero. Unit: cases per case.; V: Proportion of the population given a fully protective vaccine before the epidemic; required, at least 0 and below 1. Unit: proportion.; N_pop: Population size; required, above zero. Unit: people.; c_v: Programme cost per person vaccinated; needed only for the cost per infection averted. Unit: currency per person.; z_0: Final attack rate with no programme, where s_0 = 1. Unit: proportion of the population.; z_V: Final attack rate with the programme, where s_0 = 1 minus V, as a proportion of the whole population. Unit: proportion of the population.; I_avert: Infections averted, N_pop times the difference between z_0 and z_V. Unit: infections.; I_static: Infections averted as counted by a static model that holds the attack rate at z_0, N_pop times V times z_0. Unit: infections.; C_avert: Cost per infection averted, c_v times N_pop times V divided by I_avert. Unit: currency per infection averted.

    Assumption: The final size relation applies (HE-AS-ATR-009): a large closed population, lasting immunity, a negligible seed and homogeneous mixing. Everyone is susceptible before the programme, vaccination is completed before the epidemic starts and the vaccine gives complete protection, so s_0 = 1 minus V. When R_0 s_0 is 1 or less the epidemic cannot grow and the function returns a final attack rate of 0.

    Worked example (R_0 of 2 and 30% coverage, as in the article): With R_0 of 2, 30% coverage of 100,000 people and £50 per person vaccinated, the function returns final attack rates of about 0.7968 without and 0.3577 with the programme, 43,910 infections averted against 23,904 counted by a static model, and about £34.16 per infection averted. The article rounds the attack rates to three decimals before multiplying and so reports 43,900 infections averted and about £34.17. R_0 = 2; V = 0.3; N_pop = 100000; c_v = 50; z_0 = 0.796812; z_V = 0.357708; I_avert = 43910; I_static = 23904; C_avert = 34.16

    Worked example (Coverage at the herd immunity threshold): At 50% coverage, the threshold 1 minus 1/R_0 for R_0 of 2, R_0 s_0 equals 1, the epidemic cannot grow and all 79,681 infections are averted, while a static model counts 39,841. R_0 = 2; V = 0.5; N_pop = 100000; c_v = 50; z_0 = 0.796812; z_V = 0; I_avert = 79681; I_static = 39841; C_avert = 31.38

    Excel: =IF(R0Value*(1-Coverage)<=1,0,REDUCE(1-Coverage,SEQUENCE(2000),LAMBDA(z,k,(1-Coverage)*(1-EXP(-R0Value*z))))) Returns z_V in Excel 365 from named cells R0Value and Coverage; with Coverage set to 0 the same formula returns z_0. Infections averted then follow from =Population*(FinalSizeNone-FinalSizeProgramme).

    R: final_size <- function(R0, s0, n = 2000) if (R0*s0 <= 1) 0 else Reduce(function(z, k) s0*(1-exp(-R0*z)), seq_len(n), s0) and averted <- function(R0, V, N) N*(final_size(R0, 1)-final_size(R0, 1-V)) Two thousand updates are ample unless R_0 s_0 is very close to 1, where the iteration slows and more updates are needed.

    Python: def final_size(R0, s0, n=2000): return 0.0 if R0*s0 <= 1 else functools.reduce(lambda z, k: s0*(1-math.exp(-R0*z)), range(n), s0) and def averted(R0, V, N): return N*(final_size(R0, 1)-final_size(R0, 1-V)) Uses the functools and math modules.

    Test (Solution satisfies the final size relation): Substituting z_V back into the relation returns the same value. Expected result: TRUE. Excel check: =ABS(FinalSizeProgramme-(1-Coverage)*(1-EXP(-R0Value*FinalSizeProgramme)))<1E-9

    Test (Round trip through HE-FM-ATR-005): When z_V is above zero, the R_0 formula applied to z_V and s_0 returns the input R_0. Expected result: TRUE. Excel check: =ABS(-LN(1-FinalSizeProgramme/(1-Coverage))/FinalSizeProgramme-R0Value)<1E-6

    Test (Static count no larger than the dynamic count): In this model the infections averted are at least the static count, N_pop times V times z_0. Expected result: TRUE. Excel check: =Population*(FinalSizeNone-FinalSizeProgramme)>=Population*Coverage*FinalSizeNone

    Common error (Holding the attack rate fixed when coverage changes): A static model that applies z_0 to the unvaccinated counts 23,904 of the 43,910 infections averted in the article's example, about 54%, and gives about £62.75 per infection averted instead of £34.16.

    Common error (Starting the iteration at zero): Starting from z = 0 returns the trivial solution z = 0, which satisfies the relation but is not the final size of the epidemic when R_0 s_0 exceeds 1. The iteration starts from s_0.

    Source: Miller JC. A note on the derivation of epidemic final sizes. Bulletin of Mathematical Biology. 2012;74(9):2125-2141. Introduction: the final size relation of the SIR model.

    s_0 = 1 - V; z_V = s_0 * (1 - exp(-R_0 * z_V)) solved by iteration from z_V = s_0; I_avert = N_pop * (z_0 - z_V); I_static = N_pop * V * z_0; C_avert = c_v * N_pop * V / I_avert

Try this function

Implementations

  • Excel

    Basic reproduction number from a final attack rate in one cell

    Excel uses LN, the natural logarithm, on named cells holding the final attack rate and the susceptible proportion at the start.

    =-LN(1-FinalSize/Susceptible0)/FinalSize

Assumptions

  • Final size relation assumptions for estimating R_0

    The population is large and closed, with no births, deaths or migration during the epidemic; infection gives lasting immunity; the epidemic is seeded by a negligible number of cases; and mixing is homogeneous. Ma and Earn note that the relation holds whatever the distribution of infectious periods and with a latent stage, but fails under some heterogeneous mixing, such as a core group for sexually transmitted infections.

  • Completed epidemic and an infection-based final attack rate

    z is measured after the epidemic has ended and counts infections, not only symptomatic cases. An attack rate taken part way through the epidemic, or from clinical cases alone, gives too low an estimate of R_0.

Worked examples

  • Basic reproduction number from a final attack rate of 0.797

    In the article's illustrative epidemic in a fully susceptible population, a final attack rate of 0.797 implies R_0 of about 2.001, close to the value of 2 used to generate it; the small excess comes from rounding z to three decimals.

    z = 0.797; s_0 = 1; R_0 = 2.001
  • Basic reproduction number with 30% prior immunity

    With 30% of the population immune at the start, s_0 is 0.7, and the article's final attack rate of 0.358 again implies R_0 of about 2.001.

    z = 0.358; s_0 = 0.7; R_0 = 2.001

Common errors

  • Estimating R_0 from a clinical attack rate

    Illustrative figures: if only half of the infections in the article's example caused symptoms, a clinical attack rate of 0.40 would imply R_0 of about 1.28 instead of 2.

  • Ignoring prior immunity when estimating R_0 from a final attack rate

    Treating the final attack rate of 0.358 from a population with 30% immune as though everyone had been susceptible gives R_0 of about 1.24 instead of 2.

Sources

  • Derivation of the SIR final size relation

    Miller JC. A note on the derivation of epidemic final sizes. Bulletin of Mathematical Biology. 2012;74(9):2125-2141. Introduction: the final size relation of the SIR model for a large population with constant transmission and recovery rates and mass action mixing, and its slight modification when the initial susceptible proportion is not close to 1.

    View source →

  • Conditions under which the epidemic final size formula holds

    Ma J, Earn DJD. Generality of the final size formula for an epidemic of a newly invading infectious disease. Bulletin of Mathematical Biology. 2006;68(3):679-702. Abstract: the formula holds regardless of the distribution of infectious periods and is unchanged by a latent stage, but fails under certain kinds of heterogeneous mixing.

    View source →

Canonical Identity