Skip to contents

Adjusts target data to client zones using a PUMA-to-client zone crosswalk. Use when PUMA targets must be allocated to client zones for weighting and reporting.

Usage

adjust_target_to_study_zones(puma_targets, puma_crosswalk, settings)

Arguments

puma_targets

data.table. Required columns:

  • puma_id <character/integer> — PUMA identifier

  • h_total — total households in PUMA

  • p_total — total persons in PUMA

  • Additional columns: household and person targets (e.g., h_* and p_* fields) Rows: one per PUMA. Keys: (puma_id). Modified by reference: no (returns copy).

puma_crosswalk

data.table with required columns:

  • puma_id <character/integer> — PUMA identifier

  • client_zone — client zone name

  • client_zone_id — client zone identifier

  • prop_hh — proportion of PUMA households in zone

  • prop_per — proportion of PUMA persons in zone Rows: one per mapping. Keys: (puma_id, client_zone_id). Modified by reference: no (returns copy).

settings

list. Must include:

  • force_balance_hh_weights

  • study_unit

Value

data.table. Aggregated client zone targets. Columns:

  • client_zone_id — client zone identifier

  • h_total — total households in zone

  • p_total — total persons in zone

  • Additional columns: household and person targets (e.g., h_* and p_* fields) Rows: one per client zone. Keys: (client_zone_id). Modified by reference: no (returns copy).

Details

  • Merges PUMA targets with crosswalk, scaling by household/person proportion.

  • Aggregates targets to client zones, excluding out-of-region areas.

  • Checks that new target sums match or are less than original PUMA targets.

  • Reports and trims PUMAs extending outside the study region.

  • Returns a copy; does not modify by reference.

Settings

  • force_balance_hh_weights (direct): Whether to balance household weights. Default from config/settings.json.

  • study_unit (direct): Study unit type. Default from config/settings.json.

See also

Examples

## Not run:
# puma_targets <- ... # PUMA target data
# puma_crosswalk <- ... # PUMA-to-client zone crosswalk
# settings <- ... # pipeline settings
# zone_targets <- adjust_target_to_study_zones(
#   puma_targets, puma_crosswalk, settings
# )
## End(Not run)