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 contact scaling functionality #224

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

pratikunterwegs
Copy link
Collaborator

  • Please check if the PR fulfills these requirements
  • I have read the CONTRIBUTING guidelines
  • A new item has been added to NEWS.md
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Checks have been run locally and pass
  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

This PR is WIP on #220 since I had some time and this functionality would be generally useful. cc-ing @adamkucharski and @ellen-is for feedback.

  1. Added a contact_scaling argument to final_size() and r_eff() that allows uniform or group-wise scaling of social contacts; defaults to 1.0 for no scaling. It would be worth checking that the contacts scaling is done correctly, and that overall this is what the issue requires.
  2. Added tests and documentation for the new argument;
  3. Added a new vignette aiming to make plot similar to https://github.com/ellen-is/reckoners. The vignette figures don't include any uncertainty as I haven't added any of the stochasticity around contacts. I've made a bunch of fairly naive assumptions around how a policy label translates to age-specific contact scaling, feel free to edit these as needed.
  • What is the current behavior? (You can also link to an open issue here)

See discussion under issue #220 for feature request.

  • What is the new behavior (if this is a feature change)?

final_size() and r_eff() scale the contact_matrix argument by the contact_scaling argument to allow simulation of the effect of reducing social contacts overall or in a group-specific way.

  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

Unlikely.

  • Other information:

I expect the benchmarking workflow will fail; see #223.

@adamkucharski
Copy link
Member

Will review in more detail shortly, but from a quick play this is looking nice. One feature socialmixr has is the ability to extract setting specific contacts, e.g.

contact_data_school <- socialmixr::contact_matrix(
  polymod,
  countries = "United Kingdom",
  age.limits = c(0, 5, 12, 17, 40, 65),
  filter = list(cnt_school = 1),
  symmetric = TRUE
)

Perhaps the simplest way would be to add up the relevant entries to get the appropriate scaling factors for school_scaling? So wouldn't require any changes to functionality - just parameter definitions in the vignette.

Also copying @sbfnk in case he has thoughts.

@pratikunterwegs
Copy link
Collaborator Author

Just rebased this following #219.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants