Skip to contents

Adjusts PUMS weights so PUMA-level sums match ACS reference counts for initial expansion. Use when PUMS and ACS must be aligned for weighting.

Usage

adjust_pums_to_reference(ref_counts, pums_unadjusted, settings)

Arguments

ref_counts

data.table with required columns:

  • bg_geoid — block group GEOID

  • PUMA — PUMA code

  • ref_count_hh — household reference count

  • ref_count_per — person reference count Rows: one per block group. Keys: (bg_geoid). Modified by reference: no (returns copy).

pums_unadjusted

data.table with required columns:

  • PUMA — PUMA code

  • WGTP — household weight

  • PWGTP — person weight Rows: one per household/person. Keys: (PUMA). Modified by reference: no (returns copy).

settings

list. Must include:

  • adjust_pums_to_acs

Value

data.table. PUMS data with adjusted weights. Same schema as input.

Details

  • Checks if adjustment is requested via settings.

  • Computes allocation factors for each PUMA using ACS and PUMS counts.

  • Adjusts household and person weights as needed.

  • Verifies adjusted totals match reference counts; errors if not.

  • Reports differences before and after adjustment.

Settings

  • adjust_pums_to_acs (direct): Whether to adjust PUMS weights. Default from config/settings.json.

Examples

## Not run:
# ref_counts <- ... # block group ACS counts
# pums_unadjusted <- ... # PUMS data
# settings <- ... # pipeline settings
# adjusted <- adjust_pums_to_reference(
#   ref_counts, pums_unadjusted, settings
# )
## End(Not run)