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

Add intervention & restructure simulate_tree_from_pop() #97

Merged
merged 18 commits into from
Oct 2, 2023

Conversation

jamesmbaazam
Copy link
Member

This PR introduces two key changes:

  • It partly addresses Implement interventions in models #3 by adding a feature to scale R0 through the mean of offspring_dist. The PR introduces the intvn_scale_r0() function for achieving this. The function only works for poison and negative binomial offspring distributions because their mean represents $R_0$. An error is thrown when r0_reduction > 0 but offspring_dist is neither pois nor nbinom.

  • In the process of including this feature, it became necessary to restructure the simulate_tree_from_pop() function. It now uses ... to pass extra arguments to pois and nbinom. The offspring_disp and offspring_mean arguments have been removed. This was not an issue previously but became necessary to streamline how intvn_scale_r0() works.

@jamesmbaazam jamesmbaazam added the enhancement New feature or request label Sep 26, 2023
@jamesmbaazam jamesmbaazam added this to the v0.1.0 milestone Sep 26, 2023
@jamesmbaazam jamesmbaazam self-assigned this Sep 26, 2023
@jamesmbaazam jamesmbaazam marked this pull request as draft September 26, 2023 20:19
@jamesmbaazam jamesmbaazam marked this pull request as ready for review September 27, 2023 16:26
Copy link
Contributor

@sbfnk sbfnk left a comment

Choose a reason for hiding this comment

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

Nice work!

R/intervention.R Outdated Show resolved Hide resolved
R/intervention.R Outdated Show resolved Hide resolved
R/intervention.R Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Merging #97 (7e80d51) into main (a3cbf4a) will increase coverage by 0.10%.
Report is 26 commits behind head on main.
The diff coverage is 100.00%.

❗ Current head 7e80d51 differs from pull request most recent head 036aa88. Consider uploading reports for the commit 036aa88 to get more accurate results

@@            Coverage Diff             @@
##             main      #97      +/-   ##
==========================================
+ Coverage   98.80%   98.91%   +0.10%     
==========================================
  Files           8        9       +1     
  Lines         419      459      +40     
==========================================
+ Hits          414      454      +40     
  Misses          5        5              
Files Coverage Δ
R/intervention.R 100.00% <100.00%> (ø)
R/simulate.r 98.99% <100.00%> (+0.19%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jamesmbaazam jamesmbaazam merged commit f164e12 into main Oct 2, 2023
8 checks passed
@jamesmbaazam jamesmbaazam deleted the add_interventions branch October 2, 2023 14:30
@pratikunterwegs
Copy link
Collaborator

Just taking a look at this after hearing about it in the developer meeting now, would be good to see where there are commonalities with {epidemics} interventions. If the intervention here is primarily affecting a single value, then it's pretty similar to a <rate_intervention> - happy to discuss how these could be brought closer together.

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
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants