Functions & Formulae

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

Attack rate, secondary attack rate and final epidemic size function

AR = A / N; SAR = S / (H - P); RR = AR_e / AR_ne; VE = 1 - AR_v / AR_u; z = s_0 * (1 - exp(-R_0 * z))

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.

  • Overall attack rate from new cases and the population at risk

    AR = A / N

    Divides the number of new cases meeting the case definition during a stated period by the number of people at risk at the start of that period. The result is an incidence proportion, usually reported as a percentage. A food-specific attack rate uses the same formula with the people who ate a given food as the denominator.

  • Secondary attack rate among household contacts of primary cases

    SAR = S / (H - P)

    Divides the cases that arise among contacts after the primary cases, for example within one incubation period, by the number of contacts. The number of contacts is often taken as the total population of the households of the primary cases minus the primary cases themselves. The measure separates spread within households, barracks or other closed settings from spread in the wider community.

  • Attack rate ratio between exposed and unexposed groups

    RR = AR_e / AR_ne

    Divides the attack rate in the exposed group, such as people who ate a suspected food, by the attack rate in the unexposed group. The result is a risk ratio that measures the association between the exposure and illness: a ratio of 1 indicates the same risk in both groups, and a ratio above 1 a higher risk among the exposed.

  • Vaccine efficacy or effectiveness from attack rates in vaccinated and unvaccinated people

    VE = 1 - AR_v / AR_u

    Measures the proportionate reduction in risk among vaccinated people as 1 minus the ratio of the attack rate among the vaccinated to the attack rate among the unvaccinated. The same quantity is the risk difference divided by the attack rate among the unvaccinated. It is called efficacy when measured in a trial under ideal conditions and effectiveness when measured under field conditions.

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

    R_0 = -log(1 - z / s_0) / z

    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.