Run the scenario analysis grid.

run_scenario_grid(
  end_date = NULL,
  samples = 1,
  upper_case_bound = NULL,
  start_date = "2019-12-31",
  show_progress = FALSE,
  delay_sample_func = NULL,
  kept_dates = NULL
)

Arguments

end_date

Character string in the format "2020-01-01". The date to run the model too.

samples

Numeric, defaults to 1. The number of samples to take for each scenario.

upper_case_bound

Numeric, defaults to NULL. The upper bound on the number of cases that will be modelled

start_date

Character string in the format "2020-01-01". The date to start the outbreak from + the event duration.

show_progress

Logical, defaults to FALSE. Show progress be shown.

delay_sample_func

Function to generate sample reporting delays. If not supplied defaults to a delay function fitted to the linelist of Chinese cases.

kept_dates

Character vector with dates in the format "2020-01-01". Indicates which dates to return data on. Defaults to all time points

Value

A data.frame of scenarios as returned by scenario_analysis

Examples

## Example if (FALSE) { grid_results <- run_scenario_grid(end_date = "2020-01-25", samples = 1, upper_case_bound = 100, show_progress = TRUE, kept_dates = c("2020-01-01", "2020-01-08", "2020-01-15", "2020-01-25")) grid_results } ## Code run_scenario_grid
#> function (end_date = NULL, samples = 1, upper_case_bound = NULL, #> start_date = "2019-12-31", show_progress = FALSE, delay_sample_func = NULL, #> kept_dates = NULL) #> { #> if (is.null(delay_sample_func)) { #> delay_sample_func <- WuhanSeedingVsTransmission::fitted_delay_sample_func #> } #> if (!is.null(kept_dates)) { #> kept_times <- purrr::map_dbl(kept_dates, ~as.numeric(lubridate::as_date(.) - #> lubridate::as_date(start_date))) #> } #> else { #> kept_times <- NULL #> } #> scenarios <- tidyr::expand_grid(event_size = c(20, 40, 60, #> 80, 100, 200, 400), event_duration = c(1, 7, 14, 21, #> 28), serial = list(tibble::tibble(serial_type = c("MERS-like", #> "SARS-like", "initial SARS-like"), serial_mean = c(6.8, #> 8.4, 10), serial_sd = c(4.1, 3.8, 2.8), serial_fn = c(WuhanSeedingVsTransmission::rgamma_with_mean_sd, #> WuhanSeedingVsTransmission::rweibull_with_mean_sd, WuhanSeedingVsTransmission::rweibull_with_mean_sd))), #> R0 = list(tibble::tibble(upper_R0 = c(1, 2, 3, 4), lower_R0 = c(0, #> 1, 2, 3)))) %>% tidyr::unnest("R0") %>% tidyr::unnest("serial") %>% #> dplyr::mutate(scenario = 1:dplyr::n()) #> sampled_and_set_parameters <- tibble::tibble(sample = 1:samples, #> k = 0.16, outbreak_length = (lubridate::as_date(end_date) - #> lubridate::as_date(start_date)) %>% as.numeric(), #> upper_case_bound = upper_case_bound) #> scenario_sims <- scenarios %>% WuhanSeedingVsTransmission::scenario_analysis(sampled_and_set_parameters, #> delay_sample_func, show_progress = show_progress, kept_times = kept_times) #> return(scenario_sims) #> } #> <bytecode: 0x55a6b4404980> #> <environment: namespace:WuhanSeedingVsTransmission>