Apply the delay to generate a point nowcast Generate a point estimate of a completed reporting square (or rectangle) from a reporting triangle that we want to complete with a nowcast and a delay pmf. 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/7cce3ae2728116e8c8cc0e4ab29074462c24650e/code/baseline/functions.R#L55 #nolint
Source:R/apply_delay.R
apply_delay.Rd
Apply the delay to generate a point nowcast Generate a point estimate of a completed reporting square (or rectangle) from a reporting triangle that we want to complete with a nowcast and a delay pmf. 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/7cce3ae2728116e8c8cc0e4ab29074462c24650e/code/baseline/functions.R#L55 #nolint
Value
expectation, matrix of the same number of rows and columns as the
triangle_to_nowcast
but with the missing values filled in as point
estimates
Examples
triangle <- matrix(
c(
80, 50, 25, 10,
100, 50, 30, 20,
90, 45, 25, NA,
80, 40, NA, NA,
70, NA, NA, NA
),
nrow = 5,
byrow = TRUE
)
delay_pmf <- get_delay_estimate(
triangle = triangle,
max_delay = 3,
n_history = 4
)
reporting_square <- apply_delay(
triangle_to_nowcast = triangle,
delay_pmf = delay_pmf
)
print(reporting_square)
#> [,1] [,2] [,3] [,4]
#> [1,] 80 50 25.00000 10.00000
#> [2,] 100 50 30.00000 20.00000
#> [3,] 90 45 25.00000 17.77778
#> [4,] 80 40 23.15789 15.90643
#> [5,] 70 35 20.26316 13.91813