Estimates Rt by region. See the documentation for epinow for further information. The progress of producing estimates across multiple regions is tracked using the progressr package. Modify this behaviour using progressr::handlers and enable it in batch by setting R_PROGRESSR_ENABLE=TRUE as an environment variable.

regional_epinow(
  reported_cases,
  target_folder,
  target_date,
  non_zero_points = 2,
  summary = TRUE,
  summary_dir,
  region_scale = "Region",
  all_regions_summary = TRUE,
  return_estimates = TRUE,
  max_plot = 10,
  return_timings = FALSE,
  ...
)

Arguments

reported_cases

A data frame of confirmed cases (confirm) by date (date), and region (region).

target_folder

Character string specifying where to save results (will create if not present).

target_date

Date, defaults to maximum found in the data if not specified.

non_zero_points

Numeric, the minimum number of time points with non-zero cases in a region required for that region to be evaluated. Defaults to 2.

summary

Logical, should summary measures be calculated.

summary_dir

A character string giving the directory in which to store summary of results.

region_scale

A character string indicating the name to give the regions being summarised.

all_regions_summary

Logical, defaults to TRUE. Should summary plots for all regions be returned rather than just regions of interest.

return_estimates

Logical, defaults to TRUE. Should estimates be returned.

max_plot

Numeric, defaults to 10. A multiplicative upper bound on the number of cases shown on the plot. Based on the maximum number of reported cases.

return_timings

Logical, defaults to FALSE. If not returning estimates can be used to request timing data is returned.

...

Pass additional arguments to epinow

Value

A list of output stratified at the top level into regional output and across region output summary output

Examples

# \donttest{ ## Construct example distributions generation_time <- get_generation_time(disease = "SARS-CoV-2", source = "ganyani") incubation_period <- get_incubation_period(disease = "SARS-CoV-2", source = "lauer") reporting_delay <- list(mean = log(10), mean_sd = log(2), sd = log(2), sd_sd = log(1.1), max = 30) ## Uses example case vector cases <- EpiNow2::example_confirmed[1:40] cases <- data.table::rbindlist(list( data.table::copy(cases)[, region := "testland"], cases[, region := "realland"])) ## Run basic nowcasting pipeline ## Here we reduce the accuracy of the GP approximation in order to reduce runtime out <- regional_epinow(reported_cases = cases, generation_time = generation_time, delays = list(incubation_period, reporting_delay), stan_args = list(warmup = 200, cores = ifelse(interactive(), 4, 1)))
#> INFO [2020-10-13 19:44:41] Reporting estimates using data up to: 2020-04-01 #> INFO [2020-10-13 19:44:41] Producing estimates for: testland, realland #> INFO [2020-10-13 19:44:41] Regions excluded: none #> INFO [2020-10-13 19:44:41] Showing progress using progressr. Modify this behaviour using progressr::handlers. #> INFO [2020-10-13 19:44:41] Initialising estimates for: testland #> WARN [2020-10-13 19:50:29] testland: Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable. #> Running the chains for more iterations may help. See #> http://mc-stan.org/misc/warnings.html#bulk-ess - #> INFO [2020-10-13 19:50:30] Completed estimates for: testland #> INFO [2020-10-13 19:50:31] Initialising estimates for: realland #> WARN [2020-10-13 19:56:55] realland: Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable. #> Running the chains for more iterations may help. See #> http://mc-stan.org/misc/warnings.html#bulk-ess - #> WARN [2020-10-13 19:56:56] realland: Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable. #> Running the chains for more iterations may help. See #> http://mc-stan.org/misc/warnings.html#tail-ess - #> INFO [2020-10-13 19:56:56] Completed estimates for: realland #> INFO [2020-10-13 19:56:56] Completed regional estimates #> INFO [2020-10-13 19:56:56] Regions with estimates: 2 #> INFO [2020-10-13 19:56:56] Regions with runtime errors: 0 #> INFO [2020-10-13 19:56:56] Producing summary
# }