R/aux_functions.R
extinct_prob.Rd
Calculate proportion of runs that have controlled outbreak
extinct_prob(outbreak_df_week, cap_cases, week_range = 12:16)
a data.table
: weekly cases produced by the
outbreak model
a positive integer
scalar: number of cumulative cases at
which the branching process (simulation) was terminated
a positive integer
vector: giving the (zero indexed)
week range to test for whether an extinction occurred. Default is 12:16
.
a single numeric
with the probability of extinction
The cap_cases
argument should be equal to the value supplied to
outbreak_model()
(possibly passed from scenario_sim()
).
res <- scenario_sim(
n = 10,
initial_cases = 1,
offspring = offspring_opts(
community = \(n) rnbinom(n = n, mu = 2.5, size = 0.16),
isolated = \(n) rnbinom(n = n, mu = 0.5, size = 1)
),
delays = delay_opts(
incubation_period = \(n) rweibull(n = n, shape = 2.32, scale = 6.49),
onset_to_isolation = \(n) rweibull(n = n, shape = 1.65, scale = 4.28)
),
event_probs = event_prob_opts(
asymptomatic = 0,
presymptomatic_transmission = 0.5,
symptomatic_ascertained = 0.2
),
interventions = intervention_opts(quarantine = FALSE),
sim = sim_opts(cap_max_days = 350, cap_cases = 4500)
)
extinct_prob(res, cap_cases = 4500)
#> [1] 0.6