Move forward one generation in the branching process

outbreak_step(
  case_data = NULL,
  disp.iso = NULL,
  disp.com = NULL,
  r0isolated = NULL,
  r0community = NULL,
  prop.asym = NULL,
  incfn = NULL,
  delayfn = NULL,
  prop.ascertain = NULL,
  k = NULL,
  quarantine = NULL,
  r0subclin = NULL,
  disp.subclin = NULL
)

Arguments

case_data

a data.table: cases in outbreak so far; initially generated by outbreak_setup()

disp.iso

a positive numeric scalar: dispersion parameter for isolated cases (must be >0)

disp.com

a positive numeric scalar: dispersion parameter for non-isolated cases (must be >0)

r0isolated

a positive numeric scalar: reproduction number for isolated cases (must be >0)

r0community

a positive numeric scalar: reproduction number for non-isolated cases (must be >0)

prop.asym

a nonnegative numeric scalar: proportion of cases that are completely asymptomatic (sublinical) (between 0 and 1)

incfn

a function that samples from incubation period Weibull distribution; generated using dist_setup()

delayfn

a function that samples from the onset-to-hospitalisation delay Weibull distribution; generated using dist_setup()

prop.ascertain

a nonnegative numeric scalar: proportion of infectious contacts ascertained by contact tracing (must be 0<=x<=1)

k

a numeric scalar: skew parameter for sampling the serial interval from the incubation period

quarantine

a logical scalar: whether quarantine is in effect, if TRUE then traced contacts are isolated before symptom onset

r0subclin

a positive numeric scalar: reproduction number for sub-clinical non-isolated cases (must be >0)

disp.subclin

a positive numeric scalar: dispersion parameter for sub-clincial non-isolated cases (must be >0)

Value

A list with three elements:

  1. $cases: a data.table with case data

  2. $effective_r0: a numeric with the effective reproduction number

  3. $cases_in_gen: a numeric with the number of new cases in that generation

Author

Joel Hellewell

Examples

# incubation period sampling function
incfn <- dist_setup(dist_shape = 2.32, dist_scale = 6.49)
# delay distribution sampling function
delayfn <- dist_setup(dist_shape = 1.65, dist_scale = 4.28)
# generate initial cases
case_data <- outbreak_setup(
  num.initial.cases = 5,
  incfn = incfn,
  delayfn = delayfn,
  k = 1.95,
  prop.asym = 0
)
case_data
#>    exposure   asym caseid infector missed    onset new_cases isolated_time
#>       <num> <lgcl>  <int>    <num> <lgcl>    <num>    <lgcl>         <num>
#> 1:        0  FALSE      1        0   TRUE 4.385409        NA      5.985869
#> 2:        0  FALSE      2        0   TRUE 3.446895        NA      5.047355
#> 3:        0  FALSE      3        0   TRUE 9.163309        NA     10.763769
#> 4:        0  FALSE      4        0   TRUE 3.989371        NA      5.589831
#> 5:        0  FALSE      5        0   TRUE 6.167557        NA      7.768017
#>    isolated
#>      <lgcl>
#> 1:    FALSE
#> 2:    FALSE
#> 3:    FALSE
#> 4:    FALSE
#> 5:    FALSE
# generate next generation of cases
out <- outbreak_step(
  case_data = case_data,
  disp.iso = 1,
  disp.com = 0.16,
  disp.subclin = 0.16,
  r0isolated = 0,
  r0subclin = 1.25,
  r0community = 2.5,
  prop.asym = 0,
  incfn = incfn,
  delayfn = delayfn,
  prop.ascertain = 0,
  k = 1.95,
  quarantine = FALSE
)
case_data <- out[[1]]
case_data
#>    exposure   asym caseid infector missed    onset new_cases isolated_time
#>       <num> <lgcl>  <int>    <num> <lgcl>    <num>     <num>         <num>
#> 1: 0.000000  FALSE      1        0   TRUE 4.385409         1      5.985869
#> 2: 0.000000  FALSE      2        0   TRUE 3.446895         0      5.047355
#> 3: 0.000000  FALSE      3        0   TRUE 9.163309         0     10.763769
#> 4: 0.000000  FALSE      4        0   TRUE 3.989371         0      5.589831
#> 5: 0.000000  FALSE      5        0   TRUE 6.167557         0      7.768017
#> 6: 4.309422  FALSE      6        1   TRUE 8.740109        NA     13.278195
#>    isolated
#>      <lgcl>
#> 1:     TRUE
#> 2:     TRUE
#> 3:     TRUE
#> 4:     TRUE
#> 5:     TRUE
#> 6:    FALSE