Internal function that handles calling epinow()
. Future work will extend
this function to better handle stan logs and allow the user to modify
settings between regions.
Usage
run_region(
target_region,
generation_time,
delays,
truncation,
rt,
backcalc,
gp,
obs,
stan,
horizon,
CrIs,
data,
target_folder,
target_date,
return_output,
output,
complete_logger,
verbose,
progress_fn = NULL,
...
)
Arguments
- target_region
Character string indicating the region being evaluated
- generation_time
A call to
gt_opts()
(or its aliasgeneration_time_opts()
) defining the generation time distribution used. For backwards compatibility a list of summary parameters can also be passed.- delays
A call to
delay_opts()
defining delay distributions and options. See the documentation ofdelay_opts()
and the examples below for details.- truncation
A call to
trunc_opts()
defining the truncation of the observed data. Defaults totrunc_opts()
, i.e. no truncation. See theestimate_truncation()
help file for an approach to estimating this from data where thedist
list element returned byestimate_truncation()
is used as thetruncation
argument here, thereby propagating the uncertainty in the estimate.- rt
A list of options as generated by
rt_opts()
defining Rt estimation. Defaults tort_opts()
. To generate new infections using the non-mechanistic model instead of the renewal equation model, usert = NULL
. The non-mechanistic model internally uses the settingrt = rt_opts(use_rt = FALSE, future = "project", gp_on = "R0")
.- backcalc
A list of options as generated by
backcalc_opts()
to define the back calculation. Defaults tobackcalc_opts()
.- gp
A list of options as generated by
gp_opts()
to define the Gaussian process. Defaults togp_opts()
. Set toNULL
to disable the Gaussian process.- obs
A list of options as generated by
obs_opts()
defining the observation model. Defaults toobs_opts()
.- stan
A list of stan options as generated by
stan_opts()
. Defaults tostan_opts()
. Can be used to overridedata
,init
, andverbose
settings if desired.- horizon
Numeric, defaults to 7. Number of days into the future to forecast.
- CrIs
Numeric vector of credible intervals to calculate.
- data
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.
- return_output
Logical, defaults to FALSE. Should output be returned, this automatically updates to TRUE if no directory for saving is specified.
- output
A character vector of optional output to return. Supported options are the individual regional estimates ("regions"), samples ("samples"), plots ("plots"), copying the individual region dated folder into a latest folder (if
target_folder
is not null, set using "latest"), the stan fit of the underlying model ("fit"), and an overall summary across regions ("summary"). The default is to return samples and plots alongside summarised estimates and summary statistics. Iftarget_folder
is not NULL then the default is also to copy all results into a latest folder.- complete_logger
Character string indicating the logger to output the completion of estimation to.
- verbose
Logical defaults to FALSE. Outputs verbose progress messages to the console from
epinow()
.- progress_fn
Function as returned by
progressr::progressor()
. Allows the use of a progress bar. If NULL (default), no progress bar is used.- ...
Pass additional arguments to
epinow()
. See the documentation forepinow()
for details.
Value
A list of processed output as produced by process_region()