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
list
with class<ringbp_offspring_opts>
: the offspring distributionfunction
s for the ringbp model, returned byoffspring_opts()
. Contains three elements:community
,isolated
, andasymptomatic
- delays
a
list
with class<ringbp_delay_opts>
: the delay distributionfunction
s for the ringbp model, returned bydelay_opts()
. Contains two elements:incubation_period
andonset_to_isolation
- event_probs
a
list
with class<ringbp_event_prob_opts>
: the event probabilities for the ringbp model, returned byevent_prob_opts()
. Contains three elements:asymptomatic
,presymptomatic_transmission
andsymptomatic_ascertained
- interventions
a
list
with class<ringbp_intervention_opts>
: the intervention settings for the ringbp model, returned byintervention_opts()
. Contains one element:quarantine
Value
A list
with three elements:
$cases
: adata.table
with case data$effective_r0
: anumeric
with the effective reproduction number$cases_in_gen
: anumeric
with the number of new cases in that generation
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_ascertained = 0
)
interventions <- intervention_opts(quarantine = FALSE)
# generate initial cases
case_data <- outbreak_setup(
initial_cases = 5,
delays = delays,
event_probs = event_probs
)
case_data
#> Index: <asymptomatic>
#> exposure asymptomatic caseid infector isolated missed onset new_cases
#> <num> <lgcl> <int> <num> <lgcl> <lgcl> <num> <lgcl>
#> 1: 0 FALSE 1 0 FALSE TRUE 5.388645 NA
#> 2: 0 FALSE 2 0 FALSE TRUE 3.260320 NA
#> 3: 0 FALSE 3 0 FALSE TRUE 12.919082 NA
#> 4: 0 FALSE 4 0 FALSE TRUE 6.080151 NA
#> 5: 0 FALSE 5 0 FALSE TRUE 3.669456 NA
#> isolated_time
#> <num>
#> 1: 8.854622
#> 2: 11.988717
#> 3: 21.825460
#> 4: 6.251773
#> 5: 5.438428
# 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 isolated missed onset new_cases
#> <num> <lgcl> <int> <num> <lgcl> <lgcl> <num> <num>
#> 1: 0.000000 FALSE 1 0 TRUE TRUE 5.388645 0
#> 2: 0.000000 FALSE 2 0 TRUE TRUE 3.260320 0
#> 3: 0.000000 FALSE 3 0 TRUE TRUE 12.919082 1
#> 4: 0.000000 FALSE 4 0 TRUE TRUE 6.080151 0
#> 5: 0.000000 FALSE 5 0 TRUE TRUE 3.669456 1
#> 6: 12.554511 FALSE 6 3 FALSE TRUE 18.124106 NA
#> 7: 4.489831 FALSE 7 5 FALSE TRUE 7.724711 NA
#> isolated_time
#> <num>
#> 1: 8.854622
#> 2: 11.988717
#> 3: 21.825460
#> 4: 6.251773
#> 5: 5.438428
#> 6: 23.208225
#> 7: 8.588712