This function takes in as input the triangle that we want to nowcast and the delay pmf, which may have been estimated separately. It uses the delay pmf to compute, for each forecast date and delay, the expected number of confirmed cases on that forecast date at that delay d. For each delay, it estimates an independent negative binomial dispersion parameter. This code was adapted from code written (under an MIT license) by the Karlsruhe Institute of Technology RESPINOW German Hospitalization Nowcasting Hub, Modified from: https://github.com/KITmetricslab/RESPINOW-Hub/blob/39e2b17bc79492b0aee4c0b615a1c8dbf978ef53/code/baseline/functions.R#L142 #nolint
Usage
estimate_uncertainty(
triangle_to_nowcast,
delay_pmf,
n_history_dispersion = nrow(triangle_to_nowcast) - 1
)
Arguments
- triangle_to_nowcast
matrix of the incomplete reporting triangle to be nowcasted, with rows representing the time points of reference and columns representing the delays
- delay_pmf
Vector of delays assumed to be indexed starting at the first delay column in
triangle_to_nowcast
- n_history_dispersion
Integer indicating the number of reference dates to be used in the estimate of the dispersion, always starting from the most recent refrence date. The default is to use the whole reporting triangle, so
nrow(triangle_to_nowcast) - 1
Examples
triangle <- matrix(
c(
70, 40, 20, 5,
80, 50, 10, 10,
100, 40, 31, 20,
95, 45, 21, NA,
82, 42, NA, NA,
70, NA, NA, NA
),
nrow = 6,
byrow = TRUE
)
delay_pmf <- get_delay_estimate(
triangle = triangle,
max_delay = 3,
n_history = 4
)
disp_params <- estimate_uncertainty(
triangle_to_nowcast = triangle,
delay_pmf = delay_pmf,
n_history_dispersion = 5
)