Arguments
- regional_output
A list of output as produced by
regional_epinow
and stored in theregional
list.- results_dir
A character string indicating the folder containing the
EpiNow2
results to extract.- date
A Character string (in the format "yyyy-mm-dd") indicating the date to extract data for. Defaults to "latest" which finds the latest results available.
- samples
Logical, defaults to
TRUE
. Should samples be returned.- forecast
Logical, defaults to
FALSE
. Should forecast results be returned.
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 <- estimate_delay(rlnorm(100, log(6), 1), max_value = 10)
#> Warning: `samples` must be at least 1000. Now setting it to 1000 internally.
#> Warning: `samples` must be at least 1000. Now setting it to 1000 internally.
#> Warning: `samples` must be at least 1000. Now setting it to 1000 internally.
#> Warning: `samples` must be at least 1000. Now setting it to 1000 internally.
#> Warning: `samples` must be at least 1000. Now setting it to 1000 internally.
#> Warning: `samples` must be at least 1000. Now setting it to 1000 internally.
#> Warning: `samples` must be at least 1000. Now setting it to 1000 internally.
#> Warning: `samples` must be at least 1000. Now setting it to 1000 internally.
#> Warning: `samples` must be at least 1000. Now setting it to 1000 internally.
#> Warning: `samples` must be at least 1000. Now setting it to 1000 internally.
# example case vector
cases <- example_confirmed[1:30]
cases <- data.table::rbindlist(list(
data.table::copy(cases)[, region := "testland"],
cases[, region := "realland"]
))
# save results to tmp folder
dir <- file.path(tempdir(check = TRUE), "results")
# run multiregion estimates
regional_out <- regional_epinow(
reported_cases = cases,
generation_time = generation_time_opts(generation_time),
delays = delay_opts(incubation_period + reporting_delay),
rt = rt_opts(rw = 7), gp = NULL,
output = c("regions", "latest"),
target_folder = dir,
return_output = TRUE
)
#> INFO [2023-09-26 15:54:35] Producing following optional outputs: regions, latest
#> Logging threshold set at INFO for the EpiNow2 logger
#> Writing EpiNow2 logs to the console and: /tmp/RtmpH53zkW/regional-epinow/2020-03-22.log
#> Logging threshold set at INFO for the EpiNow2.epinow logger
#> Writing EpiNow2.epinow logs to: /tmp/RtmpH53zkW/epinow/2020-03-22.log
#> INFO [2023-09-26 15:54:35] Reporting estimates using data up to: 2020-03-22
#> INFO [2023-09-26 15:54:35] Saving estimates to : /tmp/RtmpH53zkW/results
#> INFO [2023-09-26 15:54:35] Producing estimates for: testland, realland
#> INFO [2023-09-26 15:54:35] Regions excluded: none
#> INFO [2023-09-26 15:55:05] Completed estimates for: testland
#> INFO [2023-09-26 15:55:30] Completed estimates for: realland
#> INFO [2023-09-26 15:55:30] Completed regional estimates
#> INFO [2023-09-26 15:55:30] Regions with estimates: 2
#> INFO [2023-09-26 15:55:30] Regions with runtime errors: 0
#> INFO [2023-09-26 15:55:30] Saving timings information to : /tmp/RtmpH53zkW/results
# from output
results <- get_regional_results(regional_out$regional, samples = FALSE)
names(results)
#> [1] "estimates"
# from a folder
folder_results <- get_regional_results(results_dir = dir, samples = FALSE)
names(folder_results)
#> [1] "estimates"
# }