zepid.calc.utils.population_attributable_fraction

zepid.calc.utils.population_attributable_fraction(a, b, c, d)

Calculates the population attributable fraction (PAF) from count data

Population attributable fraction is calculated as

\[PAF = \left(\frac{a + c}{a + b + c + d} - \frac{c}{c + d}\right) / \frac{a + c}{a + b + c + d} = (R - R_0) / R\]
Parameters:
  • a (integer, float) – Count of exposed individuals with outcome
  • b (integer, float) – Count of unexposed individuals with outcome
  • c (integer, float) – Count of exposed individuals without outcome
  • d (integer, float) – Count of unexposed individuals without outcome
Returns:

Population attributable fraction

Return type:

float

Examples

Return the population attributable fraction

>>> from zepid.calc import population_attributable_fraction
>>> population_attributable_fraction(45, 55, 21, 79)