Probability that an outbreak will be contained
Source:R/probability_contain.R
probability_contain.RdOutbreak containment is defined as outbreak extinction when
simulate = FALSE. When simulate = FALSE, probability_contain() is
equivalent to calling probability_extinct().
When simulate = TRUE, outbreak containment is defined by the
case_threshold (default = 100) and outbreak_time arguments.
Firstly, case_threshold sets the size of the transmission chain below
which the outbreak is considered contained. Secondly, outbreak_time sets
the time duration from the start of the outbreak within which the outbreak
is contained if there is no more onwards transmission beyond this time.
When setting an outbreak_time, a generation_time is also required.
case_threshold and outbreak_time can be jointly set.
Overall, when simulate = TRUE, containment is defined as the size and
time duration of a transmission chain not reaching the case_threshold
and outbreak_time, respectively.
Usage
probability_contain(
R,
k,
num_init_infect,
ind_control = 0,
pop_control = 0,
simulate = FALSE,
...,
case_threshold = 100,
outbreak_time = Inf,
generation_time = NULL,
offspring_dist
)Arguments
- R
A
numberspecifying the \(R\) parameter (i.e. average secondary cases per infectious individual).- k
A
numberspecifying the \(k\) parameter (i.e. dispersion in offspring distribution from fitted negative binomial).- num_init_infect
An
integer(or at least "integerish" if stored as double) specifying the number of initial infections.- ind_control
A
numericspecifying the strength of individual-level control measures. These control measures assume that infected individuals do not produce any secondary infections with probabilityind_control, thus increasing the proportion of cases that do not create any subsequent infections. The control measure is between0(default) and1(maximum).- pop_control
A
numericspecifying the strength of population-level control measures that reduce the transmissibility of all cases by a constant factor. Between0(default) and1(maximum).- simulate
A
logicalboolean determining whether the probability of containment is calculated analytically or numerically using a stochastic branching process model. Default isFALSEwhich callsprobability_extinct(), setting toTRUEuses a branching process and enables setting thecase_threshold,outbreak_timeandgeneration_timearguments.- ...
<
dynamic-dots> Named elements to replace default arguments in.chain_sim(). See details.- case_threshold
A number for the threshold of the number of cases below which the epidemic is considered contained.
case_thresholdis only used whensimulate = TRUE.- outbreak_time
A number for the time since the start of the outbreak to determine if outbreaks are contained within a given period of time.
outbreak_timeis only used whensimulate = TRUE.- generation_time
A
functionto generate generation times. The function must have a single argument and return anumericvector with generation times. See details for example. Thefunctioncan be defined or anonymous.generation_timeis only used whensimulate = TRUE.- offspring_dist
An
<epiparameter>object. An S3 class for working with epidemiological parameters/distributions, seeepiparameter::epiparameter().
Details
When using simulate = TRUE, the default arguments to simulate the
transmission chains with .chain_sim() are 105 replicates,
a negative binomial (nbinom) offspring distribution, parameterised with
R (and pop_control if > 0) and k.
When setting the outbreak_time argument, the generation_time argument is
also required. The generation_time argument requires a random number
generator function. For example, if we assume the generation time is
lognormally distributed with meanlog = 1 and sdlog = 1.5, then we can
define the function to pass to generation_time as:
function(x) rlnorm(x, meanlog = 1, sdlog = 1.5)References
Lloyd-Smith, J. O., Schreiber, S. J., Kopp, P. E., & Getz, W. M. (2005) Superspreading and the effect of individual variation on disease emergence. Nature, 438(7066), 355-359. doi:10.1038/nature04153
Examples
# population-level control measures
probability_contain(R = 1.5, k = 0.5, num_init_infect = 1, pop_control = 0.1)
#> [1] 0.8213172
# individual-level control measures
probability_contain(R = 1.5, k = 0.5, num_init_infect = 1, ind_control = 0.1)
#> [1] 0.8391855
# both levels of control measures
probability_contain(
R = 1.5,
k = 0.5,
num_init_infect = 1,
ind_control = 0.1,
pop_control = 0.1
)
#> [1] 0.8915076
# multi initial infections with population-level control measures
probability_contain(R = 1.5, k = 0.5, num_init_infect = 5, pop_control = 0.1)
#> [1] 0.3737271
# probability of containment within a certain amount of time
# this requires parameterising a generation time
gt <- function(n) {
rlnorm(n, meanlog = 1, sdlog = 1.5)
}
probability_contain(
R = 1.2,
k = 0.5,
num_init_infect = 1,
simulate = TRUE,
case_threshold = 50,
outbreak_time = 20,
generation_time = gt
)
#> [1] 0.73942