epiverse-trace / serofoi

Estimates the Force-of-Infection of a given pathogen from population based sero-prevalence studies
https://epiverse-trace.github.io/serofoi/
Other
17 stars 4 forks source link

fix(bug): correct exposure_expanded matrix calculation avoiding loops #146

Closed ntorresd closed 7 months ago

ntorresd commented 7 months ago

This PR fixes the bug described in #145 . The right exposure triangular matrix with respect to the anti-diagonal is computed avoiding for loops by:

ly <- NCOL(foi_expanded)
exposure_expanded <- matrix(0, nrow = ly, ncol = ly)
exposure_expanded[apply(
  lower.tri(exposure_expanded, diag = TRUE),
  1, rev
  )] <- 1
codecov-commenter commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

:exclamation: No coverage uploaded for pull request base (143-fix-prepare_serodata@dd0ca8d). Click here to learn what that means.

:exclamation: Current head 022d3ff differs from pull request most recent head d6f23ba. Consider uploading reports for the commit d6f23ba to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## 143-fix-prepare_serodata #146 +/- ## =========================================================== Coverage ? 70.12% =========================================================== Files ? 10 Lines ? 1754 Branches ? 0 =========================================================== Hits ? 1230 Misses ? 524 Partials ? 0 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.