I19 contact matrices#35
Conversation
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>
…llaboration/comoDTC into i19-contact-matrices
Co-Authored-By: Sumali Bajaj <34308572+sumalibajaj@users.noreply.github.com>
rccreswell
left a comment
There was a problem hiding this comment.
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?
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
left a comment
There was a problem hiding this comment.
Thanks @oscardm20994 and @sumalibajaj -- looking really good now. Just a few more inline comments sorry but very close.
| #' 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 |
There was a problem hiding this comment.
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?)
There was a problem hiding this comment.
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.
@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