Set up initial cases for branching process

outbreak_setup(
  initial_cases,
  incubation_period,
  onset_to_isolation,
  prop_asymptomatic
)

Arguments

initial_cases

a nonnegative integer scalar: number of initial or starting cases which are all assumed to be missed.

incubation_period

a function: a random number generating function that samples from incubation period distribution, the function accepts a single integer argument specifying the number of times to sample the incubation period (i.e. length of the function output).

onset_to_isolation

a function: a random number generating function that accepts a single integer argument specifying the length of the function output.

prop_asymptomatic

a numeric scalar probability (between 0 and 1 inclusive): proportion of cases that are completely asymptomatic (subclinical)

Value

data.table of cases in outbreak so far. data.table columns are:

  • $exposure: numeric

  • $asymptomatic: logical

  • $caseid: integer

  • $infector: numeric

  • $missed: logical

  • $onset: numeric

  • $new_cases: logical

  • $isolated_time: numeric

  • $isolated: logical

Author

Joel Hellewell

Examples

# incubation period sampling function
incubation_period <- \(x) rweibull(n = x, shape = 2.32, scale = 6.49)
# delay distribution sampling function
onset_to_isolation <- \(x) rweibull(n = x, shape = 1.65, scale = 4.28)
out <- outbreak_setup(
  initial_cases = 1,
  incubation_period = incubation_period,
  onset_to_isolation = onset_to_isolation,
  prop_asymptomatic = 0
)
out
#> 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.876985        NA
#>    isolated_time
#>            <num>
#> 1:      16.88827