Refuse a survey_pop with unknown bands instead of under-counting - #381
Draft
sbfnk-bot wants to merge 2 commits into
Draft
Refuse a survey_pop with unknown bands instead of under-counting#381sbfnk-bot wants to merge 2 commits into
sbfnk-bot wants to merge 2 commits into
Conversation
…ed for Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #379.
add_survey_upper_age_limit()drops rows whosepopulationisNAbefore the population is aggregated. The age group containing them is then reported and weighted as though those people did not exist, and nothing says so:The only warning raised is "Large differences in the size of the sub-populations…", which is a consequence of the under-count and sends the reader to their age limits rather than to their population data.
NAin a population table means unknown, not nobody. Treating it as nobody is the one reading that yields a plausible number rather than a complaint, which is why this survives unnoticed.contact_matrix()now rejects it:This is the behaviour the
compute_matrix()pipeline already had —joint_population_vector()requires a row per grouping level, so the same population errors there with "survey_popis missing population entries for some grouping". The two paths now agree.It joins the population rules #374 added — fine enough, reaching high enough, starting no higher than the youngest group — as a fourth: known across the range in use.
Scope
Only bands at or above the youngest age group asked for are checked. Bands below it are dropped whether or not they hold a population, so an unknown one there changes nothing and is still accepted.
The all-
NAand zero-row cases keep their existing, more specific message ("survey_popholds no population data"), which fires earlier.Verification
The three added tests fail on
advance-deprecationswith this commit reverted (2 failures) and pass here, so they pin the change rather than the wording. Pluralisation checked at one, two and eleven unknown bands. 507 tests pass;lint_package()on an installed copy reports no lints.Based on
advance-deprecations(#374), which is where the sibling population rules live; it will retarget tomainwhen that merges. Parallel to #380 rather than stacked on it — the two touch different parts ofcontact_matrix.R.