Generate retrospective nowcasts
Source:R/generate_pt_nowcast_mat_list.R
generate_pt_nowcast_mat_list.Rd
This function ingests a list of incomplete reporting triangles and
generates a list of reporting squares, or "complete"
point estimates of reporting triangles based on the delay estimated in
each triangle. It uses the specified n
number of
observations to estimate the empirical delay for each retrospective
reporting triangle.
Arguments
- reporting_triangle_list
List of reporting triangle matrices, in order from most recent (most complete) to least recent. Bottom right of the matrices should contain NAs.
- max_delay
Integer indicating the maximum delay to estimate, in units of the delay. The default is to use one less than the minimum number of rows of all of the matrices in the
list_of_rts
.- n
Integer indicating the number of observations (number of rows) to use to estimate the delay distribution for each reporting triangle. Default is the minimum of the number of rows of all the matrices in the
list_of_rts
.
Value
pt_nowcast_matr_list
List of the same number of elements as the
input reporting_triangle_list
but with each reporting triangle filled
in based on the delay estimated in that reporting triangle.
Examples
triangle <- matrix(
c(
65, 46, 21, 7,
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 = 7,
byrow = TRUE
)
trunc_rts <- truncate_triangles(
reporting_triangle = triangle
)
retro_rts <- generate_triangles(
trunc_rep_mat_list = trunc_rts
)
retro_pt_nowcast_mat_list <- generate_pt_nowcast_mat_list(
reporting_triangle_list = retro_rts
)
print(retro_pt_nowcast_mat_list[[1]])
#> [,1] [,2] [,3] [,4]
#> [1,] 65 46.00000 21.00000 7.000000
#> [2,] 70 40.00000 20.00000 5.000000
#> [3,] 80 50.00000 10.00000 10.000000
#> [4,] 100 40.00000 31.00000 9.502924
#> [5,] 95 45.00000 22.50317 9.030878
#> [6,] 82 41.82672 19.90693 7.988127