Define a list of
_opts()
to pass to regional_epinow
_opts()
accepting arguments.
This is useful when different settings are needed between regions within a single
regional_epinow
call. Using opts_list
the defaults can be applied to all regions
present with an override passed to regions as necessary (either within opts_list
or
externally).
opts_list(opts, reported_cases, ...)
An _opts()
function call such as rt_opts()
A data frame containing a region
variable
indicating the target regions
Optional override for region defaults. See the examples for use case.
A named list of options per region which can be passed to the _opt
accepting arguments of regional_epinow
regional_epinow rt_opts
# uses example case vector
cases <- example_confirmed[1:40]
cases <- data.table::rbindlist(list(
data.table::copy(cases)[, region := "testland"],
cases[, region := "realland"]
))
# default settings
opts_list(rt_opts(), cases)
#> $testland
#> $testland$prior
#> $testland$prior$mean
#> [1] 1
#>
#> $testland$prior$sd
#> [1] 1
#>
#>
#> $testland$use_rt
#> [1] TRUE
#>
#> $testland$rw
#> [1] 0
#>
#> $testland$use_breakpoints
#> [1] TRUE
#>
#> $testland$future
#> [1] "latest"
#>
#> $testland$pop
#> [1] 0
#>
#> $testland$gp_on
#> [1] "R_t-1"
#>
#>
#> $realland
#> $realland$prior
#> $realland$prior$mean
#> [1] 1
#>
#> $realland$prior$sd
#> [1] 1
#>
#>
#> $realland$use_rt
#> [1] TRUE
#>
#> $realland$rw
#> [1] 0
#>
#> $realland$use_breakpoints
#> [1] TRUE
#>
#> $realland$future
#> [1] "latest"
#>
#> $realland$pop
#> [1] 0
#>
#> $realland$gp_on
#> [1] "R_t-1"
#>
#>
# add a weekly random walk in realland
opts_list(rt_opts(), cases, realland = rt_opts(rw = 7))
#> $testland
#> $testland$prior
#> $testland$prior$mean
#> [1] 1
#>
#> $testland$prior$sd
#> [1] 1
#>
#>
#> $testland$use_rt
#> [1] TRUE
#>
#> $testland$rw
#> [1] 0
#>
#> $testland$use_breakpoints
#> [1] TRUE
#>
#> $testland$future
#> [1] "latest"
#>
#> $testland$pop
#> [1] 0
#>
#> $testland$gp_on
#> [1] "R_t-1"
#>
#>
#> $realland
#> $realland$prior
#> $realland$prior$mean
#> [1] 1
#>
#> $realland$prior$sd
#> [1] 1
#>
#>
#> $realland$use_rt
#> [1] TRUE
#>
#> $realland$rw
#> [1] 7
#>
#> $realland$use_breakpoints
#> [1] TRUE
#>
#> $realland$future
#> [1] "latest"
#>
#> $realland$pop
#> [1] 0
#>
#> $realland$gp_on
#> [1] "R_t-1"
#>
#>
# add a weekly random walk externally
rt <- opts_list(rt_opts(), cases)
rt$realland$rw <- 7
rt
#> $testland
#> $testland$prior
#> $testland$prior$mean
#> [1] 1
#>
#> $testland$prior$sd
#> [1] 1
#>
#>
#> $testland$use_rt
#> [1] TRUE
#>
#> $testland$rw
#> [1] 0
#>
#> $testland$use_breakpoints
#> [1] TRUE
#>
#> $testland$future
#> [1] "latest"
#>
#> $testland$pop
#> [1] 0
#>
#> $testland$gp_on
#> [1] "R_t-1"
#>
#>
#> $realland
#> $realland$prior
#> $realland$prior$mean
#> [1] 1
#>
#> $realland$prior$sd
#> [1] 1
#>
#>
#> $realland$use_rt
#> [1] TRUE
#>
#> $realland$rw
#> [1] 7
#>
#> $realland$use_breakpoints
#> [1] TRUE
#>
#> $realland$future
#> [1] "latest"
#>
#> $realland$pop
#> [1] 0
#>
#> $realland$gp_on
#> [1] "R_t-1"
#>
#>