-
Notifications
You must be signed in to change notification settings - Fork 7
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
Final epidemic size with susceptibility groups #39
Conversation
We’re still getting errors in the 1. simple, 2. complex, and 3. Polymod data case, with the final sizes returned as either 0.0 or This behaviour is not uniform across test runs. It seems a maximum of 7 tests are failing, but sometimes only 5 fail. The failures are also not uniform across systems: locally, 5-7 tests fail (Mac M2), but only 1 test (the complex data case) fails on GHA. However, all 7 fail on Windows GHA. Latest build reports are here: https://github.com/epiverse-trace/finalsize/actions/runs/3111847610/jobs/5044606831 Possible reasons:
|
* WIP finalsize_grps_cpp tests: test Newton solver * WIP finalsize_grps_cpp tests: Test internal solve fun * Check finalsize_grps_cpp with r0 = 1.3 (passes) * Check finalsize_grps with r0 = 2.0 (fails) * WIP formatting for R tests * Test Cpp solve_by_susc with r0 = 2.0 (fails) * Return ArrayXd * Rcpp export return ArrayXd * Test Newton solver with r0 = 2.0 (fails)
R implementation of final size of an epidemic with susceptibility groups. * WIP - first draft finalsize_grps in R * WIP - first draft tests for finalsize_grps in R * WIP - missing comma for args * Split off epi_spread and remove Newton solver * Implement iterative solver for susc grps, fixes #44 * Use iterative solver in final_size_grps, fixes #45 * Test for epi_spread, WIP #46, #47 * Add tests for iterative solver, fixes #46 * Test final_size_grps, fixes #47 * Documentation for final_size_grps and related fns, fixes #48 * Add extra test for epi_spread, WIP #46, #47 * Minor refactor of p_susc in epi_spread_data, remove commented code * Housekeeping: No explicit namespacing for testthat * Kronecker con_mat replication, vectors instead of mats, fixes #49 * Vectorise con_mat filling in iterative solver, fixes #51 * Vectorise fn_f in iterative solver, and pi adjust, fixes #52 * Squash stopifnot calls into one, fixes #50 * Pass function args re solver steps, solves #53 * Update tests for epi_spread and final_size_grps * Refactor final size from pi to epi_final_size, fixes #54 * Remove test for Newton solver
Correct struct member in return
Move Rcpp C++ 11 plugin to header Format helper functions WIP move helper funs to new header
Fun for epi spread returns custom struct
Minor whitespace
WIP remove unused params WIP add documentation for finalsize by grp WIP add iterations as fn arg to Newton solver WIP minor edits, eg. to remove atuo return types WIP finalsize_by_grp add checks on args WIP finalsize_by_grp begin documentation
Add tests for internal funs in helper_funs.h Add tests for cpp funs in finalsize.h WIP - add tests: finalsize_grps_cpp with polymod data WIP finalsize_grps_cpp: scale contacts and test for NaN WIP finalsize_grps_tests: check for correct proportions infected WIP - checks for final size = 0 Add more tests for final size cpp code Check that final sizes are not Inf, NaN, or zero Add check for p_susceptibility rowwise sum = 1.0 WIP finalsize_grps_cpp tests: Add check for error on p_susc sum WIP finalsize_grps_cpp tests: do not scale contacts in simple case WIP finalsize_grps_cpp tests: p_susceptibility in tests sums to 1 WIP finalsize_grps_cpp tests: test susc - final size relation WIP finalsize_grps_cpp tests: scale contacts by r0 and scale demo
Procedural Rcpp export Supress permissive export, export new finalsize by grp fun
* WIP finalsize_grps_cpp tests: test Newton solver * WIP finalsize_grps_cpp tests: Test internal solve fun * Check finalsize_grps_cpp with r0 = 1.3 (passes) * Check finalsize_grps with r0 = 2.0 (fails) * WIP formatting for R tests * Test Cpp solve_by_susc with r0 = 2.0 (fails) * Return ArrayXd * Rcpp export return ArrayXd * Test Newton solver with r0 = 2.0 (fails)
Closing this PR as (1) we are instead focusing on an R implementation of the Newton solver, and (2) the commit history has been wrecked by rebasing on to |
Implements:
finalsize.h
.final_size_grps_cpp
. This callssolve_final_size_by_susceptibility
,solve_final_size_newton
, andepi_spread
from the header.Warning!
Build sometimes fails because the test for
final_size_grps_cpp
fails to calculate the correct final size, instead returning implausible values - likely due to an issue with the Newton solver. Tagging @BlackEdder in case this can be fixed.Review input requested
p_susceptibility
andsusceptibility
parameters in function documentation.