Implementation
The probability mass function for the final size distribution of Reed-Frost outbreaks is derived in Lefevre & Picard (1990) (equation 3.10):
where:
- \(n_{(k)} = n!/(n-k)!\) is the falling factorial,
- \(k\) is the number of infections beyond the initial infections,
- \(n\) is the initial number susceptible (called \(S_0\) above),
- \(m\) is the initial number infected (called \(I_0\) above),
- \(p\) is the probability of effective contact (i.e., that any infected infects any susceptible in a time step),
- \(G_k\) are the Gontcharoff polynomials.
Gontcharoff polynomials
In general, the Gontcharoff polynomials are (equation 2.1):
For convenience, define \(g(k, q, m) \equiv G_k(1 | q^{m+i}, i \in \mathbb{N})\), a version of the Gontcharoff polynomials that are specific to this application, so that:
Preventing overflow
In practice, the formulation for \(f\) and \(g\) above lead to numerical overflow. To avoid this, define \(h(k, q, m) = k! \times g(k, q, m)\) such that:
and
The use of binomial coefficients, rather than pure factorials, increases the range of values \(k\) and \(n\) before causing overflow.
Caveats
Large \(n\) can cause overflow, but in practice, numerical instability is a more pressing problem that leads to values of \(f\) greater than unity.