Move forward one generation in the branching process
Arguments
- case_data
a
data.table: cases in outbreak so far; initially generated byoutbreak_setup()- offspring
a
listwith class<ringbp_offspring_opts>: the offspring distributionfunctions for the ringbp model, returned byoffspring_opts(). Contains three elements:community,isolated, andasymptomatic- delays
a
listwith class<ringbp_delay_opts>: the delay distributionfunctions for the ringbp model, returned bydelay_opts(). Contains 4 elements:incubation_period,onset_to_isolation,latent_periodandonset_to_self_isolation- event_probs
a
listwith class<ringbp_event_prob_opts>: the event probabilities for the ringbp model, returned byevent_prob_opts(). Contains 5 elements:asymptomatic,presymptomatic_transmission,alpha,symptomatic_tracedandsymptomatic_self_isolate- interventions
a
listwith class<ringbp_intervention_opts>: the intervention settings for the ringbp model, returned byintervention_opts(). Contains 2 elements:quarantineandtest_sensitivity
Value
A list with three elements:
$cases: adata.tablewith case data$effective_r0: anumericwith the effective reproduction number$cases_in_gen: anumericwith the number of new cases in that generation
Details
Each new case is assigned an isolation time (isolated_time) as the
earliest of up to three pathways; a case to which no pathway applies is
never isolated (isolated_time is Inf):
Self-isolation: a symptomatic case self-isolates with probability
symptomatic_self_isolate(fromevent_prob_opts()), entering isolation anonset_to_self_isolationdelay (fromdelay_opts()) after symptom onset. Self-isolating cases are not tested.Testing: a symptomatic case that does not self-isolate is tested and returns a positive result with probability
test_sensitivity(fromintervention_opts()), entering isolation anonset_to_isolationdelay after symptom onset. A false-negative result does not isolate the case via this pathway.Tracing: a case whose infector is symptomatic is traced with probability
symptomatic_traced(fromevent_prob_opts()). Whenquarantineis active (fromintervention_opts()) tracing is exposure-based: a traced case is isolated when its infector is isolated, regardless of its own symptom status. Withoutquarantine, only a traced symptomatic case is isolated, and no earlier than its own symptom onset.
Self-isolation and testing are symptom-based, so asymptomatic cases are
isolated only via the tracing pathway, and only when quarantine is active.
Examples
offspring <- offspring_opts(
community = \(n) rnbinom(n = n, mu = 2.5, size = 0.16),
isolated = \(n) rnbinom(n = n, mu = 0, size = 1),
asymptomatic = \(n) rnbinom(n = n, mu = 1.25, size = 0.16)
)
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.15,
symptomatic_traced = 0
)
interventions <- intervention_opts(quarantine = FALSE)
# generate initial cases
case_data <- outbreak_setup(
initial_cases = 5,
delays = delays,
event_probs = event_probs,
interventions = interventions
)
case_data
#> Index: <self_isolate__asymptomatic>
#> exposure asymptomatic caseid infector traced onset new_cases self_isolate
#> <num> <lgcl> <int> <num> <lgcl> <num> <int> <lgcl>
#> 1: 0 FALSE 1 0 FALSE 1.173089 NA FALSE
#> 2: 0 FALSE 2 0 FALSE 8.745576 NA FALSE
#> 3: 0 FALSE 3 0 FALSE 4.773823 NA FALSE
#> 4: 0 FALSE 4 0 FALSE 7.845297 NA FALSE
#> 5: 0 FALSE 5 0 FALSE 2.786544 NA FALSE
#> isolated_time sampled
#> <num> <lgcl>
#> 1: 2.059485 FALSE
#> 2: 12.840092 FALSE
#> 3: 11.844717 FALSE
#> 4: 8.844933 FALSE
#> 5: 6.115403 FALSE
# generate next generation of cases
out <- outbreak_step(
case_data = case_data,
offspring = offspring,
delays = delays,
event_probs = event_probs,
interventions = interventions
)
case_data <- out[[1]]
case_data
#> exposure asymptomatic caseid infector traced onset new_cases
#> <num> <lgcl> <int> <num> <lgcl> <num> <int>
#> 1: 0.000000 FALSE 1 0 FALSE 1.173089 0
#> 2: 0.000000 FALSE 2 0 FALSE 8.745576 1
#> 3: 0.000000 FALSE 3 0 FALSE 4.773823 1
#> 4: 0.000000 FALSE 4 0 FALSE 7.845297 0
#> 5: 0.000000 FALSE 5 0 FALSE 2.786544 0
#> 6: 11.076900 FALSE 6 2 FALSE 19.220878 NA
#> 7: 6.707449 FALSE 7 3 FALSE 11.060438 NA
#> self_isolate isolated_time sampled
#> <lgcl> <num> <lgcl>
#> 1: FALSE 2.059485 TRUE
#> 2: FALSE 12.840092 TRUE
#> 3: FALSE 11.844717 TRUE
#> 4: FALSE 8.844933 TRUE
#> 5: FALSE 6.115403 TRUE
#> 6: FALSE 22.211813 FALSE
#> 7: FALSE 18.344412 FALSE