report_cases: Report case counts by date of report

Description Usage Arguments Value Examples

Description

Report case counts by date of report

Usage

1
2
3
4
5
6
7
8
report_cases(
  nowcast,
  case_forecast = NULL,
  delay_defs,
  incubation_defs,
  type = "median",
  reporting_effect
)

Arguments

nowcast

A dataframe as produced by nowcast_pipeline

case_forecast

A data.table of case forecasts as produced by epi_measures_pipeline If not supplied the default is not incoperate forecasts.

delay_defs

A data.table that defines the delay distributions (model, parameters and maximum delay for each model). See get_delay_dist for an example of the structure.

incubation_defs

A data.table that defines the incubation distributions (model, parameters and maximum delay for each model). See get_delay_dist for an example of the structure.

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 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.

Value

A data.table containing the following variables sample, date and cases

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
## 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)

epiforecasts/EpiNow documentation built on Oct. 26, 2020, 2:38 p.m.