-
Notifications
You must be signed in to change notification settings - Fork 1
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
Replace contact interval with infectious period #96
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Josh. The change looks good to me.
If I understand correctly, the change means that a contact of an infected person will be infected (i.e., sampling contact infection times uniformly from the infectious period of their infected contact). I wonder if (in future iterations) this can be relaxed to be conditioned on a probability of infection given contact with an infected individual.
Additionally (not a change from this PR), could you please rename vec_idx
to something more informative?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding, this looks good – have just added a comment on James point about interpretation of contact timing (i.e. given we're only tracking times for the contact who get infected)
This is not how the simulation is implemented. An infected person will have a number of contacts (sampled from the contact distribution) and some of these will be infected (sampled from a binomial distribution with a probability of infection
Hopefully my explanation above shows that this is how it is currently implemented. The pertinent lines for sampling infections given the probability of infection are: https://github.com/epiverse-trace/simulist/pull/96/files#diff-c2df0429d588ed69b0d50211aa468cb9b478febce4398551cba32edfc9526ac2R93-R94. |
I'm happy to rename this to something more informative. Please file an issue with some suggestions. Just to be clear it is not a placeholder name that I have forgotten to update, but instead a numeric scalar or vector holding the indices of the pre-allocated vectors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have added minor suggestion for comment in code to clarify, but otherwise looks good!
This PR addresses #61 by replacing the previous simulation parameterisation of a contact interval (
contact_interval
) with an infectious period (infect_period
) as requested in #61.The core change takes place in
.sim_network_bp()
which replaces sampling from a contact interval with sampling from an infectious period. The time intervals between an infected individual and a new contact is chosen by uniformly sampling from the infectious period that case.Other functions, including the exported simulation functions (
sim_*()
) are updated to replace thecontact_interval
argument withinfect_period
. The object supplied toinfect_period
works identically to the previouscontact_interval
implementation, whereby it can be an<epidist>
object or an anonymous function.Tests and documentation (function documentation and vignettes) have been updated with the new function arguments.