epiverse-trace / simulist

An R package for simulating line lists
https://epiverse-trace.github.io/simulist/
Other
5 stars 1 forks source link

Allow setting maximum as well as minimum outbreak size #93

Closed joshwlambert closed 8 months ago

joshwlambert commented 8 months ago

This PR addresses a comment raised in #89 to allow a maximum outbreak size to be set. The min_outbreak_size argument has been changed to outbreak_size and instead of being a single numeric, it now accepts a numeric vector with two elements, the minimum outbreak size and maximum outbreak size.

The minimum outbreak size is used identically to the previous min_outbreak_size implementation, erroring if the maximum number of iterations is reached without producing an outbreak of sufficient size. The maximum outbreak size is used to limited the number of cases in the line list and terminating the simulation early (i.e. while there are still infectious individuals that could continue transmission) and returning the data with a warning. The warning states how many cases and contacts are being returned so the user is aware of the data and why it might not match expectations given the parameterisation specified.

The Get started (simulist.Rmd), visualisation (vis-linelist.Rmd) and age-structured populations (age-struct-pop.Rmd) vignettes are updated to use the new argument and provide explanation on its use.

The tests that specified the min_outbreak_size argument have been updated and new tests for the returning early warning are also added for sim_linelist() and .sim_network_bp().

Function documentation has also been updated.

joshwlambert commented 8 months ago

Closing and reopening this PR to trigger the CI workflows after a CI commit.