Get a probabilistic draw from the observation model
Source:R/add_uncertainty.R
get_nowcast_mat_draw.Rd
The function ingests an estimate of a point nowcast, in the form of a point nowcast matrix and a vector of dispersion parameters, and draws from a negative binomial to get a single expected observed probabilistic draw of a nowcast
Value
nowcast_w_obs_error
Matrix containing the same upper left values
as the point_nowcast_matrix
, with the bottom right containing
probabilistic draws assuming a negative binomial
observation model with a mean given by the lower right entries in
point_nowcast_matrix
and dispersion parameters
from disp
Examples
point_nowcast_matrix <- matrix(
c(
80, 50, 25, 10,
100, 50, 30, 20,
90, 45, 25, 17.8,
80, 40, 23.2, 15.9,
70, 35, 20.3, 19.9
),
nrow = 5,
byrow = TRUE
)
exp_obs_nowcast <- get_nowcast_mat_draw(
point_nowcast_matrix = point_nowcast_matrix,
disp = c(8, 1.4, 4)
)
print(exp_obs_nowcast)
#> [,1] [,2] [,3] [,4]
#> [1,] 80 50 25 10
#> [2,] 100 50 30 20
#> [3,] 90 45 25 14
#> [4,] 80 40 0 23
#> [5,] 70 38 35 8