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 brief explaination about the matrix operations #126

Open
avallecam opened this issue Jan 13, 2023 · 5 comments
Open

Add brief explaination about the matrix operations #126

avallecam opened this issue Jan 13, 2023 · 5 comments
Labels
Documentation Improvements or additions to documentation Help wanted Extra attention is needed question Further information is requested

Comments

@avallecam
Copy link
Member

I suggest adding a coloured box, code folding, or redirecting to an external reference for the following questions:

  • Why contact matrix is transposed?

    contact_matrix <- t(contact_data$matrix)

  • Why largest eigenvalue in the contact matrix should be 1.0?

    # scale the contact matrix so the largest eigenvalue is 1.0
    # this is to ensure that the overall epidemic dynamics correctly reflect
    # the assumed value of R0
    contact_matrix <- contact_matrix / max(eigen(contact_matrix)$values)

    • Is it part of a normalization procedure or it aims to resemble a probability of contact between 0-1?
    • Can you explain further about the statement:

      To ensure that the overall epidemic dynamics correctly reflect the assumed value of R0

  • Why divide the contact matrix with its respective age group population size?

    # divide each row of the contact matrix by the corresponding demography
    # this reflects the assumption that each individual in group {j} make contacts
    # at random with individuals in group {i}
    contact_matrix <- contact_matrix / demography_vector

    • Can you explain further about the statement:

      To reflect the assumption that each individual in group {j} make contacts at random with individuals in group {i}

  • Are both operations of a preliminary process recommended for all formal analyses? Probably depends on the input format, but this reason is strong enough to create a function for this task?

@avallecam avallecam added Documentation Improvements or additions to documentation question Further information is requested labels Jan 13, 2023
@pratikunterwegs
Copy link
Collaborator

This is a question for the epi folks - I'm not certain of the theory underlying these steps. This also relates to the need for epi training for the RSEs.

@avallecam
Copy link
Member Author

avallecam commented Jan 16, 2023

I understand. As a first step, we could add more resolution to the math concepts that a user needs to know before relating them with the math/code steps and an epi interpretation. We could invite an applied epi mathematician to the conversation, if needed.

Also, Is there a reference code (in repo or paper) you used to write these steps? It could help to understand it.

@pratikunterwegs
Copy link
Collaborator

The most convenient reference is probably the Miller (2012) paper: https://doi.org/10.1007/s11538-012-9749-6, but I haven't really understood a lot of it beyond the initial steps. Could ask @rozeggo, @adamkucharski or @BlackEdder to write two sentences on each operation - they would know the most

@sbfnk
Copy link

sbfnk commented Jan 25, 2023

I think you could remove the matrix operations if you called contact_matrix with split=TRUE (see corresponding section in the package vignette).

@pratikunterwegs
Copy link
Collaborator

I think you could remove the matrix operations if you called contact_matrix with split=TRUE (see corresponding section in the package vignette).

Thanks @sbfnk, will check if the vignettes build with this option. Still, it would be good to have a couple of sentences on why these operations are necessary, wherever they actually happen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Improvements or additions to documentation Help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants