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 point nowcast matrices, based on the delay estimated in
each triangle or the corresponding delay passed in. It uses the specified
n
number of reference times to estimate the delay in each retrospective
reporting triangle.
Arguments
- reporting_triangle_list
List of
n
truncated reporting triangle matrices with as many rows as available given the truncation.- max_delay
Integer indicating the maximum delay to estimate, in units of the delay. The default is to use the whole reporting triangle,
ncol(reporting_triangle) -1
.- n
Integer indicating the number of reference times (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
.- delay_pmf
Vector or list of vectors of delays assumed to be indexed starting at the first delay column in each of the matrices in
reporting_triangle_list
. If a list, must of the same length asreporting_triangle_list
, with elements aligning. Default isNULL
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(triangle)
retro_rts <- generate_triangles(trunc_rts)
retro_pt_nowcast_mat_list <- generate_pt_nowcast_mat_list(retro_rts)
retro_pt_nowcast_mat_list[1:3]
#> [[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
#>
#> [[2]]
#> [,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 6.414220
#> [4,] 100 40.00000 20.36587 7.347008
#> [5,] 95 53.33883 21.57749 7.784433
#>
#> [[3]]
#> NULL
#>