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

Replace contact interval with infectious period #96

Merged
merged 7 commits into from
Apr 5, 2024
Merged

Conversation

joshwlambert
Copy link
Member

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 the contact_interval argument with infect_period. The object supplied to infect_period works identically to the previous contact_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.

@joshwlambert joshwlambert added the enhancement New feature or request label Mar 22, 2024
Copy link
Member

@jamesmbaazam jamesmbaazam left a 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?

Copy link
Member

@adamkucharski adamkucharski left a 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)

@joshwlambert
Copy link
Member Author

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).

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 prob_infect). All contacts of an infected case during their infectious period are recorded in the data and used to create the contact tracing dataset (the non-infected contacts are not included in the line list). This could be viewed as first-degree contact-tracing.

I wonder if (in future iterations) this can be relaxed to be conditioned on a probability of infection given contact with an infected individual.

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.

@joshwlambert
Copy link
Member Author

could you please rename vec_idx to something more informative?

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.

Copy link
Member

@adamkucharski adamkucharski left a 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!

@joshwlambert joshwlambert merged commit 529f90f into main Apr 5, 2024
8 checks passed
@joshwlambert joshwlambert deleted the infect_period branch April 5, 2024 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants