Functions & Formulae

Each applied formula has its own function page, with a signature, implementations, and tests.

Basic reproduction number function from transmission parameters or a next-generation matrix

R(beta, gamma, K) = R_0

Maps the transmission parameters of an infection in a fully susceptible population, either a transmission rate and a recovery rate or a next-generation matrix of expected new cases by group, to the basic reproduction number R_0, a count of cases per case with no time unit. The same package derives the effective reproduction number once part of the population is immune, the herd immunity threshold with the critical vaccination coverage, and the reproduction number implied by an early exponential growth rate. R_0 estimated after a completed epidemic from its final attack rate is HE-FM-ATR-005, and the final attack rate and infections averted for a given R_0 and pre-epidemic coverage are computed in HE-CF-ATR-001, so neither is restated here. Vaccine effectiveness from attack rates (HE-FM-ATR-004) supplies E, the epidemic doubling time used in HE-FM-CFR-003 converts to the growth rate r, a per-cycle recovery probability for a cohort model follows the rate conversion of HE-FN-TP-001, and the economic treatment of herd protection as an external benefit is HE-FM-EXT-002. Notation follows the Basic Reproduction Number article.

  • Basic reproduction number of the SIR model as transmission rate times mean infectious period

    D = 1 / gamma; R_0 = beta * D

    In the simple susceptible, infectious and recovered (SIR) model, one infectious person in a fully susceptible population causes new infections at rate beta and stays infectious for a mean time D equal to 1/gamma, so R_0 is beta times D, or beta/gamma. Van den Driessche derives R_0 as the product of the transmission rate and the mean infectious time and shows that R_0 = 1 is a sharp threshold, with the number infectious falling steadily to zero below it and first rising above it. The WHO guide writes the same quantity for a homogeneously mixing population as p c D, the probability of transmission per contact times the contact rate times the duration of infectiousness, so beta here corresponds to p times c. Models with a latent stage, demography or several groups take R_0 from the next-generation matrix of HE-FM-BRN-005.

  • Effective reproduction number as the basic reproduction number times the susceptible proportion

    R_t = R_0 * x_t

    Once part of the population is immune, each case meets fewer people who can be infected. The WHO guide gives R_t = R_0 x_t for a homogeneously mixing population, where x_t is the proportion of the population still susceptible at time t, and Pitman and colleagues define the effective reproduction number in the same way. Vaccination and past infection lower x_t and so R_t, while R_0 stays the same because its definition assumes a fully susceptible population. R_t above 1 means new infections per generation are rising and below 1 falling. With an all-or-nothing vaccine of effectiveness E given to a proportion V before any spread, x_t equals 1 minus V times E, which is the starting susceptible proportion s_0 of HE-CF-ATR-001 when V times E is entered there as the fully protected proportion.

  • Herd immunity threshold and critical vaccination coverage for a vaccine of effectiveness E

    H = 1 - 1 / R_0; V_c = H / E

    Sustained spread stops once the susceptible proportion is below 1/R_0, so the proportion that must be immune is H = 1 minus 1/R_0, the herd immunity threshold of the WHO guide, which calls the matching level the critical effective immunisation level. Van den Driessche gives the same condition for a perfect vaccine, and Pitman and colleagues state that in a homogeneously mixing population coverage has to be greater than this value for herd immunity to occur. An all-or-nothing vaccine that fully protects a proportion E of those vaccinated immunises V times E of the population, so the critical coverage is V_c = H/E, the form Masterson and colleagues use, and when E is below H, V_c exceeds 1 and that vaccine alone cannot stop sustained spread. Pitman and colleagues and van den Driessche state the condition as coverage greater than the threshold, while the WHO guide writes p_c as at least 1 minus 1/R_0. At coverage exactly V_c the effective reproduction number of HE-FM-BRN-002 equals 1, the boundary that HE-CF-ATR-001 classifies as no major epidemic, since it returns a final attack rate of 0 whenever R_0 s_0 is 1 or less.

  • Reproduction number from the early exponential growth rate under three generation interval shapes

    T_c = T_E + T_I; R_exp = 1 + r * T_c; R_seir = (1 + r * T_E) * (1 + r * T_I); R_delta = exp(r * T_c)

    In the early phase of an outbreak new infections grow as exp(r t), and Wallinga and Lipsitch show that the reproduction number implied by a growth rate r depends only on the generation interval distribution, through R = 1/M(minus r) with M its moment generating function. An exponential generation interval with mean T_c gives R = 1 plus r T_c; a latent stage and an infectious stage, each exponentially distributed with means T_E and T_I, give (1 plus r T_E)(1 plus r T_I); and a fixed interval gives exp(r T_c), the upper bound for a given growth rate and mean. In the SIR model T_c is the mean infectious period 1/gamma, so the exponential form is van den Driessche's R_0 = 1 plus r/gamma, the inverse of r = gamma(R_0 minus 1). A growth rate taken from an epidemic doubling time T_d, as used in HE-FM-CFR-003, is log(2)/T_d.

  • Basic reproduction number of a two-group next-generation matrix as its dominant eigenvalue

    T_K = k_11 + k_22; D_K = k_11 * k_22 - k_12 * k_21; R_0 = (T_K + sqrt(T_K^2 - 4 * D_K)) / 2

    When infected people differ by group or stage, element k_ij of the next-generation matrix K is the expected number of new cases in group i caused by one newly infected person in group j, as Diekmann, Heesterbeek and Roberts define it, and R_0 is the dominant eigenvalue of K, the definition proposed by Diekmann, Heesterbeek and Metz. For a compartmental model van den Driessche writes K as F times the inverse of V, with F the rates of new infections and V the other transitions, and R_0 as its spectral radius. For two groups the dominant eigenvalue is the larger root of lambda^2 minus T_K lambda plus D_K = 0, with T_K the trace and D_K the determinant, and the term under the square root equals (k_11 minus k_22)^2 plus 4 k_12 k_21, which is never negative for a matrix of non-negative entries. When D_K is zero, as for a matrix of rank one, R_0 is the trace. Larger matrices are handled by HE-CF-BRN-001.