Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting maximum as well as minimum outbreak size #93

Merged
merged 7 commits into from
Mar 21, 2024

Conversation

joshwlambert
Copy link
Member

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 joshwlambert added documentation Improvements or additions to documentation enhancement New feature or request labels Mar 11, 2024
Copy link
Contributor

@CarmenTamayo CarmenTamayo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Josh,
Thank you for these changes, I think they're great, I've tested it and it works well, and I no longer had the problem of the simulation getting stuck or running for a really long time when setting a maximum number of cases for the outbreak.
That's why I've suggested to make the default smaller, e.g., 5K or 10K instead of 100K, to make the user experience better and minimise the risk that this will happen
Let me know what you think

Thank you!

@joshwlambert
Copy link
Member Author

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

@joshwlambert joshwlambert reopened this Mar 21, 2024
@joshwlambert joshwlambert merged commit c3dff91 into main Mar 21, 2024
8 checks passed
@joshwlambert joshwlambert deleted the outbreak_size branch March 21, 2024 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants