Skip to content

I19 contact matrices#35

Open
oscardm20994 wants to merge 23 commits into
masterfrom
i19-contact-matrices
Open

I19 contact matrices#35
oscardm20994 wants to merge 23 commits into
masterfrom
i19-contact-matrices

Conversation

@oscardm20994

Copy link
Copy Markdown

@sumalibajaj and I have written a function which processes a given contact matrix (work, home , etc) of a given country into a form that is then accepted by the ode solver. This involves a dimension expansion from a 16x16 to 21x21 to match the number of age categories in population structure data used in the ode.

The function (get_contact_matrix) takes a string of the country in question, a pre loaded contact matrix (16x16) and the number of population categories is the population structure data (always 21 unless someone edits the excel sheet). It outputs an expanded 21x21 matrix.

Currently, the user must input the new dimension and we are wondering whether this needs to be an input as opposed to simply hard coded as 21x21 as the population data will always have this dimension unless a user attempts to alter the excel sheet.

We have also implemented a testing script that tests the dimensions of the output from the function and confirms it is 21x21 as expected. We are looking at other testing procedures as the function develops. We provide a documentation file in /man/get_contact_matrix.Rd

oscardm20994 and others added 11 commits March 10, 2021 09:13
added function get_contact_matrix usins use_this()

added testing for this function through test_that(()

Co-Authored-By: Sumali Bajaj <34308572+sumalibajaj@users.noreply.github.com>
Co-Authored-By: Sumali Bajaj <34308572+sumalibajaj@users.noreply.github.com>
Co-Authored-By: Sumali Bajaj <34308572+sumalibajaj@users.noreply.github.com>
Added "5yr" in the input for number of age groups, loading contact home data in the test.
…to bring code in line with conventions

ready for the first pull request!

Co-Authored-By: Sumali Bajaj <34308572+sumalibajaj@users.noreply.github.com>
Co-Authored-By: Sumali Bajaj <34308572+sumalibajaj@users.noreply.github.com>
Co-Authored-By: Sumali Bajaj <34308572+sumalibajaj@users.noreply.github.com>
Co-Authored-By: Sumali Bajaj <34308572+sumalibajaj@users.noreply.github.com>

@rccreswell rccreswell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a very useful function, thanks @sumalibajaj and @oscardm20994
I made some minor comments.

Currently, the user must input the new dimension and we are wondering whether this needs to be an input as opposed to simply hard coded as 21x21 as the population data will always have this dimension unless a user attempts to alter the excel sheet.

I'm not sure---did you think about having a default argument (21) for n_5yr_agegroups_popstruc?

Comment thread R/get_contact_matrix.R Outdated
Comment thread R/get_contact_matrix.R Outdated
Comment thread R/get_contact_matrix.R Outdated
Comment thread R/get_contact_matrix.R Outdated
Comment thread tests/testthat/test-get_contact_matrix.R Outdated
Comment thread tests/testthat/test-get_contact_matrix.R Outdated
oscardm20994 and others added 5 commits March 13, 2021 15:21
Co-authored-by: rcw5890 <56924958+rcw5890@users.noreply.github.com>
Co-authored-by: rcw5890 <56924958+rcw5890@users.noreply.github.com>
Co-authored-by: rcw5890 <56924958+rcw5890@users.noreply.github.com>
Co-authored-by: rcw5890 <56924958+rcw5890@users.noreply.github.com>

@ben18785 ben18785 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @oscardm20994 and @sumalibajaj -- looking really good now. Just a few more inline comments sorry but very close.

Comment thread R/get_contact_matrix.R
Comment thread R/get_contact_matrix.R Outdated
Comment thread R/get_contact_matrix.R
#' structure data. these ranges start with 0-4yrs and continue with 5 year gaps
#' up until the last category of 100+ years old. Default value set to 21.
#'
#' @return A square contact matrix for the specified country with dimension

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we say what the rows versus the columns mean? (We say that it's asymmetric somewhere, but does (say) a row mean the age group we are considering and the column mean the other age group or is it vice versa?)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Done in package description - rows refer to age group of respondents (people at risk) and columns refer age group of people "contacted" by people at risk.

Comment thread tests/testthat/test-get_contact_matrix.R
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.

4 participants