[Soft-deprecated] 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)
)

Arguments

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 delay_opts() defining delay distributions and options. See the documentation of delay_opts() and the examples below for details.

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 data.table giving the weekly reporting effect with the following variables: sample (must be the same as in nowcast), effect (numeric scaling factor for each weekday), day (numeric 1 - 7 (1 = Monday and 7 = Sunday)). If not supplied then no weekly reporting effect is assumed.

CrIs

Numeric vector of credible intervals to calculate.

Value

A list of data.tables. The first entry contains the following variables sample, date and cases with the second being summarised across samples.

Examples

# \donttest{
# 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 <- bootstrapped_dist_fit(rlnorm(100, log(6), 1), max_value = 30)

# run model
out <- estimate_infections(cases,
  samples = 100,
  generation_time = generation_time,
  delays = delay_opts(incubation_period, reporting_delay),
  rt = NULL
)
#> Error in estimate_infections(cases, samples = 100, generation_time = generation_time,     delays = delay_opts(incubation_period, reporting_delay),     rt = NULL): unused argument (samples = 100)

reported_cases <- report_cases(
  case_estimates =
    out$samples[variable == "infections"][
      ,
      cases := as.integer(value)
    ][, value := NULL],
  delays = delay_opts(incubation_period, reporting_delay),
  type = "sample"
)
#> Error in unique(case_estimates$sample): object 'out' not found
print(reported_cases)
#> Error in print(reported_cases): object 'reported_cases' not found
# }