epiforecasts / socialmixr

R package for deriving social mixing matrices from survey data.
http://epiforecasts.io/socialmixr/
Other
38 stars 11 forks source link

wpp projections, contact rate per capita and matrix_plot #28

Closed lwillem closed 2 years ago

lwillem commented 3 years ago
  1. Defensive programming on user-specified "survey.pop" data.frames by making sure that the age groups are compatible with the requested age breaks. Also relocated the assignment of the upper.age.limit so this is alway applied (i.e. also when the survey is representative and with user-specified "survey.pop")
  2. Included unit-tests for the user-specified survey.pop and to handle the absence of a country column
  3. Enabled the use of projected demographics from the wpp2017 package for population details after 2015. This is done with a warning for the user that median projections of population counts are used.
  4. Enabled the generation of a "contact rates per capita" matrix with the contact_matrix function, which represents the social contact rates of one individual of age i with one individual of age j in the population. For example, this matrix can be used in infectious disease modelling to calculate the force of infection, which is based on the likelihood that one susceptible individual of age i will be in contact with one infectious individual of age j.
  5. Included a plotting function ("matrix_plot") to draw an image plot of a contact matrix with a legend strip and the numeric values in the cells. Many options can be changed, though the defaults facilitate an easy exploration of the contact matrices generated with the "contact_matrix" function.
  6. Extended the introduction.Rmd vignette with info on the participant weights, truncation and "matrix_plot" function. Changed the notation of the "contact rates between one individual of age i with contacts of age j" to m_ij, and the contact rates per captia to "c_ij", in line with published literature.
  7. Included info on the recent "filter" option in the introduction.Rmd document.
codecov[bot] commented 3 years ago

Codecov Report

Merging #28 (9f8e2ea) into master (f68f82c) will increase coverage by 0.30%. The diff coverage is 100.00%.

:exclamation: Current head 9f8e2ea differs from pull request most recent head 213d968. Consider uploading reports for the commit 213d968 to get more accurate results Impacted file tree graph

@@            Coverage Diff             @@
##           master      #28      +/-   ##
==========================================
+ Coverage   95.82%   96.12%   +0.30%     
==========================================
  Files          12       13       +1     
  Lines         814      878      +64     
==========================================
+ Hits          780      844      +64     
  Misses         34       34              
Impacted Files Coverage Δ
R/contact_matrix.r 98.76% <100.00%> (+0.05%) :arrow_up:
R/lists.r 100.00% <100.00%> (ø)
R/matrix_plot.R 100.00% <100.00%> (ø)
R/wpp_age.r 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 38fc616...213d968. Read the comment docs.

sbfnk commented 2 years ago

Ready to be merged once grDefvices dependency has been added and formatting updated.

sbfnk commented 2 years ago

Merging now to move on - remaining issues will be dealt with separately