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 two elements:incubation_periodandonset_to_isolation- event_probs
a
listwith class<ringbp_event_prob_opts>: the event probabilities for the ringbp model, returned byevent_prob_opts(). Contains three elements:asymptomatic,presymptomatic_transmissionandsymptomatic_traced- interventions
a
listwith 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.tablewith case data$effective_r0: anumericwith the effective reproduction number$cases_in_gen: anumericwith 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_traced = 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 traced onset new_cases
#> <num> <lgcl> <int> <num> <lgcl> <num> <int>
#> 1: 0 FALSE 1 0 FALSE 9.068614 NA
#> 2: 0 FALSE 2 0 FALSE 7.134836 NA
#> 3: 0 FALSE 3 0 FALSE 7.409368 NA
#> 4: 0 FALSE 4 0 FALSE 3.831935 NA
#> 5: 0 FALSE 5 0 FALSE 12.451065 NA
#> isolated_time sampled
#> <num> <lgcl>
#> 1: 17.360308 FALSE
#> 2: 10.430046 FALSE
#> 3: 9.035117 FALSE
#> 4: 15.099694 FALSE
#> 5: 16.355962 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 9.068614 6
#> 2: 0.000000 FALSE 2 0 FALSE 7.134836 0
#> 3: 0.000000 FALSE 3 0 FALSE 7.409368 0
#> 4: 0.000000 FALSE 4 0 FALSE 3.831935 0
#> 5: 0.000000 FALSE 5 0 FALSE 12.451065 14
#> 6: 10.684477 FALSE 6 1 FALSE 18.416225 NA
#> 7: 11.385832 FALSE 7 1 FALSE 15.003998 NA
#> 8: 10.176903 FALSE 8 1 FALSE 15.028419 NA
#> 9: 9.312653 FALSE 9 1 FALSE 14.598350 NA
#> 10: 10.239543 FALSE 10 1 FALSE 14.286632 NA
#> 11: 9.170390 FALSE 11 1 FALSE 18.738731 NA
#> 12: 12.990119 FALSE 12 5 FALSE 19.830682 NA
#> 13: 14.255198 FALSE 13 5 FALSE 18.637028 NA
#> 14: 12.961801 FALSE 14 5 FALSE 17.212470 NA
#> 15: 12.874304 FALSE 15 5 FALSE 15.957546 NA
#> 16: 13.131607 FALSE 16 5 FALSE 16.887905 NA
#> 17: 12.940163 FALSE 17 5 FALSE 20.887224 NA
#> 18: 14.945229 FALSE 18 5 FALSE 22.751088 NA
#> 19: 16.080431 FALSE 19 5 FALSE 21.357583 NA
#> 20: 16.174508 FALSE 20 5 FALSE 20.972771 NA
#> 21: 11.815477 FALSE 21 5 FALSE 16.492315 NA
#> 22: 13.589812 FALSE 22 5 FALSE 17.914329 NA
#> 23: 13.819688 FALSE 23 5 FALSE 23.393422 NA
#> 24: 13.327341 FALSE 24 5 FALSE 16.501959 NA
#> 25: 13.200103 FALSE 25 5 FALSE 18.777442 NA
#> exposure asymptomatic caseid infector traced onset new_cases
#> <num> <lgcl> <int> <num> <lgcl> <num> <int>
#> isolated_time sampled
#> <num> <lgcl>
#> 1: 17.360308 TRUE
#> 2: 10.430046 TRUE
#> 3: 9.035117 TRUE
#> 4: 15.099694 TRUE
#> 5: 16.355962 TRUE
#> 6: 28.556178 FALSE
#> 7: 17.060636 FALSE
#> 8: 16.828956 FALSE
#> 9: 17.496067 FALSE
#> 10: 15.093567 FALSE
#> 11: 19.700004 FALSE
#> 12: 23.311967 FALSE
#> 13: 19.374708 FALSE
#> 14: 21.566833 FALSE
#> 15: 20.703180 FALSE
#> 16: 18.116295 FALSE
#> 17: 27.919306 FALSE
#> 18: 26.830659 FALSE
#> 19: 24.046193 FALSE
#> 20: 24.443160 FALSE
#> 21: 21.049371 FALSE
#> 22: 25.547293 FALSE
#> 23: 35.288396 FALSE
#> 24: 19.650941 FALSE
#> 25: 21.420606 FALSE
#> isolated_time sampled
#> <num> <lgcl>