Validation
Validation sub-package.
checksums— recode null detection and incidence-sum overcount checks (pre-balancing).control_validation— control configuration and cross-tab marginal consistency (pre-balancing).coverage— how much of a profile's universe the control geography can place.weight_checks— post-balancing sanity checks: weighted totals against the PUMS-derived control targets, and the hierarchy identities.
checksums
Incidence-sum checksums for the weighting pipeline.
Two complementary checks share a common reporting backend:
check_recode_nulls
Runs on a recoded DataFrame before aggregation. Detects records
where a control column evaluated to null (a gap in the recode
mapping). Logs a warning by default; raises with strict=True.
check_incidence_sums
Runs on the household-level incidence table after aggregation (and
after fractional imputation for survey data). For each non-structural
control it verifies that member-column sums match the expected
structural total (p_total for person controls, h_total for
household controls). Mismatches always raise ValueError.
weight_checks
Post-balancing weight sanity checks.
Compares survey weighted totals against PUMS-derived control targets and verifies weight consistency across the table hierarchy.
coverage
How much of a profile's universe the control geography can place.
Two independent tests decide whether a household is "in the region", and they are allowed to disagree:
- the model geography, assigned by
add_zone_idswith a nearest-zone snap tolerance, which the usability profiles read through their zone axis; - the control geography, a strict point-in-polygon of the home coordinate against the target-zone file, which is what gives a household a balancing zone.
A household that passes the first and fails the second is admitted by the profile and cannot be weighted: it belongs to no zone, so no zone's controls describe it. That is a bound on what the weighting can answer. This module counts it, so the bound is stated rather than left to be inferred from a column of nulls.