Generate multiple draws of a nowcast combining observed and predicted values
Source:R/get_nowcast_pred_draws.R
get_nowcast_draws.Rd
Generate multiple draws of a nowcast combining observed and predicted values
Arguments
- point_nowcast_matrix
Matrix of point nowcast predictions and observations, with rows representing the reference times and columns representing the delays.
- reporting_triangle
Matrix of the reporting triangle, with rows representing the time points of reference and columns representing the delays. Can be a reporting matrix or incomplete reporting matrix. Can also be a ragged reporting triangle, where multiple columns are reported for the same row. (e.g. weekly reporting of daily data).
- dispersion
Vector of dispersion parameters indexed by horizon from minus one to the maximum delay.
- draws
Integer indicating the number of draws of the predicted nowcast vector to generate. Default is
1000
.- ...
Additional arguments pass to
get_nowcast_pred_draws()
Value
Dataframe containing information for multiple draws with columns
for the reference time (time
), the predicted counts (pred_count
), and
the draw number (draw
).
Examples
point_nowcast_matrix <- matrix(
c(
80, 50, 25, 10,
100, 50, 30, 20,
90, 45, 25, 16.8,
80, 40, 21.2, 19.5,
70, 34.5, 15.4, 9.1
),
nrow = 5,
byrow = TRUE
)
reporting_triangle <- generate_triangle(point_nowcast_matrix)
disp <- c(0.8, 12.4, 9.1)
nowcast_draws <- get_nowcast_draws(
point_nowcast_matrix,
reporting_triangle,
disp,
draws = 5
)
nowcast_draws
#> pred_count time draw
#> 1 165 1 1
#> 2 200 2 1
#> 3 170 3 1
#> 4 148 4 1
#> 5 73 5 1
#> 6 165 1 2
#> 7 200 2 2
#> 8 175 3 2
#> 9 168 4 2
#> 10 85 5 2
#> 11 165 1 3
#> 12 200 2 3
#> 13 181 3 3
#> 14 187 4 3
#> 15 78 5 3
#> 16 165 1 4
#> 17 200 2 4
#> 18 173 3 4
#> 19 180 4 4
#> 20 95 5 4
#> 21 165 1 5
#> 22 200 2 5
#> 23 169 3 5
#> 24 151 4 5
#> 25 211 5 5