report_cases | R Documentation |
Convolves latent infections to reported cases via an observation model.
Likely to be removed/replaced in later releases by functionality drawing on
the stan
implementation.
report_cases(
case_estimates,
case_forecast = NULL,
delays,
type = "sample",
reporting_effect,
CrIs = c(0.2, 0.5, 0.9)
)
case_estimates |
A data.table of case estimates with the following variables: date, sample, cases |
case_forecast |
A data.table of case forecasts with the following variables: date, sample, cases. If not supplied the default is not to incorporate forecasts. |
delays |
A call to |
type |
Character string indicating the method to use to transform counts. Supports either "sample" which approximates sampling or "median" would shift by the median of the distribution. |
reporting_effect |
A |
CrIs |
Numeric vector of credible intervals to calculate. |
A list of data.table
s. The first entry contains the following
variables sample
, date
and cases
with the second being summarised
across samples.
# define example cases
cases <- example_confirmed[1:40]
# set up example delays
generation_time <- get_generation_time(
disease = "SARS-CoV-2", source = "ganyani"
)
incubation_period <- get_incubation_period(
disease = "SARS-CoV-2", source = "lauer"
)
reporting_delay <- dist_spec(
mean = convert_to_logmean(2, 1), mean_sd = 0.1,
sd = convert_to_logsd(2, 1), sd_sd = 0.1, max = 10
)
# Instead of running them model we use example
# data for speed in this example.
cases <- cases[, cases := as.integer(confirm)]
cases <- cases[, confirm := NULL][, sample := 1]
reported_cases <- report_cases(
case_estimates = cases,
delays = delay_opts(incubation_period + reporting_delay),
type = "sample"
)
print(reported_cases)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.