report_cases.Rd
Report case counts by date of report
report_cases( nowcast, case_forecast = NULL, delay_defs, incubation_defs, type = "median", reporting_effect )
nowcast | A dataframe as produced by |
---|---|
case_forecast | A data.table of case forecasts as produced by |
delay_defs | A data.table that defines the delay distributions (model, parameters and maximum delay for each model).
See |
incubation_defs | A data.table that defines the incubation distributions (model, parameters and maximum delay for each model).
See |
type | Character string indicating the method to use to transfrom counts. Supports either "sample" which approximates sampling or "median" would shift by the median of the distribution. |
reporting_effect | A |
A data.table
containing the following variables sample
, date
and cases
## Define example cases cases <- data.table::as.data.table(EpiSoon::example_obs_cases) cases <- cases[, `:=`(confirm = as.integer(cases), import_status = "local")] ## Define a single report delay distribution delay_defs <- EpiNow::lognorm_dist_def(mean = 5, mean_sd = 1, sd = 3, sd_sd = 1, max_value = 30, samples = 2) ## Define a single incubation period incubation_defs <- EpiNow::lognorm_dist_def(mean = EpiNow::covid_incubation_period[1, ]$mean, mean_sd = EpiNow::covid_incubation_period[1, ]$mean_sd, sd = EpiNow::covid_incubation_period[1, ]$sd, sd_sd = EpiNow::covid_incubation_period[1, ]$sd_sd, max_value = 30, samples = 2) ## Perform a nowcast nowcast <- nowcast_pipeline(reported_cases = cases, target_date = max(cases$date), delay_defs = delay_defs, incubation_defs = incubation_defs) reported_cases <- report_cases(nowcast, delay_defs = delay_defs, incubation_defs = incubation_defs) print(reported_cases)#> sample sample date cases #> 1: 1 1 2020-01-10 1 #> 2: 1 1 2020-01-11 0 #> 3: 1 1 2020-01-12 0 #> 4: 1 1 2020-01-13 0 #> 5: 1 1 2020-01-14 0 #> --- #> 150: 2 2 2020-03-19 320 #> 151: 2 2 2020-03-20 312 #> 152: 2 2 2020-03-21 328 #> 153: 2 2 2020-03-22 350 #> 154: 2 2 2020-03-23 404