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

Splitting contact matrices by sex #89

Open
NaomiWaterlow opened this issue Aug 17, 2023 · 4 comments
Open

Splitting contact matrices by sex #89

NaomiWaterlow opened this issue Aug 17, 2023 · 4 comments

Comments

@NaomiWaterlow
Copy link

I am trying to create contact matrices split by sex. I think I can do this (using polymod data) by filtering the survey participants and contact matrices by sex, and creating the split matrices (i.e. m-m contact rates, m-f contact rates, etc.) However to get a symmetric contact matrix I think I have to assume that there is an equal age-distribution by gender in the population, (which is not the case, especially in older ages). Is there a way to do this taking the actual age-sex distributions in the population?

@sbfnk
Copy link
Collaborator

sbfnk commented May 3, 2024

This is not currently possible (you can do it for m-m and f-f but not m-f or f-m) but it might not be tricky to add. Just to make sure I understand correctly though, you want to create a matrix that is something like the one below but scaled somehow such that $C_{ij}N^f_i=C_{ji}N^m_j$?

library("socialmixr")
#> 
#> Attaching package: 'socialmixr'
#> The following object is masked from 'package:utils':
#> 
#>     cite
data(polymod)
C <- contact_matrix(
  survey = polymod,
  filter = list("part_gender" = "F", cnt_gender = "M"),
  age.limits = seq(0, 20, by = 5),
  countries = "United Kingdom"
)
#> Removing participants that have contacts without age information. To change this behaviour, set the 'missing.contact.age' option
C$matrix
#>          contact.age.group
#> age.group     [0,5)    [5,10)   [10,15)   [15,20)      20+
#>   [0,5)   0.8979592 0.3877551 0.2244898 0.1836735 1.612245
#>   [5,10)  0.3207547 2.4150943 0.4339623 0.1509434 1.924528
#>   [10,15) 0.2115385 0.6346154 2.0961538 0.4615385 2.211538
#>   [15,20) 0.1153846 0.3076923 0.6730769 2.3076923 2.673077
#>   20+     0.2798742 0.3364780 0.2735849 0.3836478 3.446541

Created on 2024-05-03 with reprex v2.1.0

@NaomiWaterlow
Copy link
Author

Yes. I want to create symetric contact matrixes for f-f, f-m, m-f and m-m, so that I can track the transmission between / across sexes, that I can use with different populations. Thanks!

@sbfnk
Copy link
Collaborator

sbfnk commented Sep 11, 2024

Sorry, I realise this is quite late but in this case could you not just use the command as above and assume that age demographics are the same for male and female parts of the population (which presumably they pretty much are in all cases)? If happy with this you could set symmetric = TRUE and get a symmetric matrix.

The general case I think could be solved by adding a contacts.pop argument and allowing the user to specify different populations for survey participants and contacts. That would be a nice addition.

@NaomiWaterlow
Copy link
Author

Thanks. Yes, this is the assumption I've gone with. I just ideally didn't want to assume that the age demographhics are the same across sexes, as for example in older ages you get more women than men (e.g. aged 90+ the population is only 30% male).

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

No branches or pull requests

2 participants