
Calculate Right-Truncation Correction Factors
Source:R/wl_helper_functions.R
calculate_truncation_correction.Rd
Computes correction factors to adjust reproduction number estimates for right-truncation bias. This bias occurs because cases near the end of the observation period may have generated secondary cases that are not yet observed.
Value
numeric vector; correction factors for each case. Values > 1 indicate upward adjustment needed. Returns NA when correction would be unreliable (probability of observation <= 0.5)
Examples
# Calculate truncation correction for recent cases
case_dates <- seq(as.Date("2023-01-01"), as.Date("2023-01-20"), by = "day")
corrections <- calculate_truncation_correction(
case_dates, si_mean = 7, si_sd = 3, si_dist = "gamma"
)
# Show how correction increases for more recent cases
tail(corrections, 5)
#> [1] NA NA NA NA NA