Implements the Wallinga-Lipsitch algorithm to estimate case reproduction numbers from incidence data and serial interval probabilities. This function performs the likelihood calculations for retrospective reproduction number estimation.
Arguments
- incidence
numeric vector; daily case counts. Must be non-negative integers. Days with zero cases will have R estimates of NA
- si_prob
numeric matrix; serial interval probability matrix from
calculate_si_probability_matrix
. Element[i,j]
represents the probability that case j infected case i- dates
vector; dates corresponding to incidence data. Used for right-truncation correction calculations
- si_mean
numeric; mean of the serial interval distribution in days
- si_sd
numeric; standard deviation of the serial interval distribution in days
- si_dist
character; distribution type for serial interval, either "gamma" or "normal"
- smoothing
integer; window size for temporal smoothing (0 = no smoothing). When > 1, applies centered moving average to reduce noise
Value
named list with two numeric vectors of the same length as incidence
:
r
: Raw case reproduction number estimates. Returns NA for days with zero cases or single-case epidemicsr_corrected
: Estimates with right-truncation correction applied. Values > 10 are capped at NA to avoid unrealistic estimates
Details
The algorithm calculates the probability that each earlier case infected each later case based on their time difference and the serial interval distribution. These probabilities are then aggregated to estimate the expected number of secondary cases generated by cases on each day.
The Wallinga-Lipsitch method works by:
Computing transmission likelihoods from earlier to later cases
Normalizing these likelihoods to create proper probabilities
Aggregating probabilities to estimate expected secondary cases per primary case
Applying right-truncation correction for cases near the observation end
The right-truncation correction accounts for the fact that cases near the end of the observation period may have generated secondary cases that occur after data collection ended.
See also
wallinga_lipsitch
for the main user interface,
calculate_si_probability_matrix
for probability matrix creation,
calculate_truncation_correction
for correction details