Run a specified number of simulations with identical parameters

scenario_sim(
  n.sim,
  prop.ascertain,
  cap_max_days,
  cap_cases,
  r0isolated,
  r0community,
  disp.iso,
  disp.com,
  k,
  delay_shape,
  delay_scale,
  num.initial.cases,
  prop.asym,
  quarantine,
  r0subclin = NULL,
  disp.subclin = NULL
)

Arguments

n.sim

a positive integer scalar: number of simulations to run

prop.ascertain

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

cap_max_days

a positive integer scalar: stop the simulation when this many days is reached.

cap_cases

a positive integer scalar: number of cumulative cases at which the branching process (simulation) was terminated

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)

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)

k

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

delay_shape

a positive numeric scalar: shape parameter of delay distribution

delay_scale

a positive numeric scalar: scale parameter of delay distribution

num.initial.cases

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

prop.asym

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

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 data.table object returning the results for multiple simulations using the same set of parameters. The table has columns

  • week: The week in the simulation.

  • weekly_cases: The number of new cases that week.

  • cumulative: The cumulative cases.

  • effective_r0: The effective reproduction rate for the whole simulation

  • cases_per_gen: A list column with the cases per generation. This is repeated each row.

  • sim: Index column for which simulation.

Author

Joel Hellewell

Examples

res <- scenario_sim(
  n.sim = 5,
  num.initial.cases = 5,
  cap_max_days = 365,
  cap_cases = 2000,
  r0isolated = 0,
  r0community = 2.5,
  disp.iso = 1,
  disp.com = 0.16,
  k = 0.7,
  delay_shape = 2.5,
  delay_scale = 5,
  prop.asym = 0,
  prop.ascertain = 0
)
res
#>       week weekly_cases cumulative effective_r0 cases_per_gen   sim
#>      <num>        <num>      <num>        <num>        <list> <int>
#>   1:     0            5          5          0.0             0     1
#>   2:     1            0          5          0.0             0     1
#>   3:     2            0          5          0.0             0     1
#>   4:     3            0          5          0.0             0     1
#>   5:     4            0          5          0.0             0     1
#>  ---                                                               
#> 261:    48            0          8          0.3           3,0     5
#> 262:    49            0          8          0.3           3,0     5
#> 263:    50            0          8          0.3           3,0     5
#> 264:    51            0          8          0.3           3,0     5
#> 265:    52            0          8          0.3           3,0     5