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

Discrepency between R and C implementations #69

Closed
TimTaylor opened this issue Oct 11, 2022 · 2 comments · Fixed by #66
Closed

Discrepency between R and C implementations #69

TimTaylor opened this issue Oct 11, 2022 · 2 comments · Fixed by #66
Assignees
Labels
Bug Something isn't working

Comments

@TimTaylor
Copy link

Assuming the c++ implementation is correct then

contact_matrix_ <- contact_matrix * demography_vector %o% susceptibility

and
contact_matrix_ <- contact_matrix * demography_vector %o% susceptibility
should be changed to

contact_matrix_ <- contact_matrix * susceptibility %o% demography_vector

or the micro optimized

contact_matrix_ <- contact_matrix * tcrossprod(susceptibility, demography_vector)

If/when the suggestion in #68 is taken up this will only need correcting in one place.
Tests that compare the c++ and R results to desired tolerance should be sufficient to test this.

@pratikunterwegs
Copy link
Collaborator

Thanks, I would say that this is fixed by this commit: 0019285, by preparing the contact matrix, after spreading through epi_spread, as so: t(t(contact_matrix * susceptibility) * demography_vector). Will close this issue along with the PR.

@Bisaloo
Copy link
Member

Bisaloo commented Oct 13, 2022

Related: #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants