Adjust ACS counts to match county totals
adjust_ref_counts_dataset.RdAdjust block group-level ACS counts (5-year) to match county-level 1-year ACS totals for weighting. Use when block group reference data is outdated or mismatched with county-level targets.
Arguments
- acs_counts
data.table. Required columns:
bg_geoid
— block group GEOID county_fips
— county FIPS code ref_count_h
— household reference count ref_count_p
— person reference count Rows: one per block group. Keys: (bg_geoid). Modified by reference: no (returns copy).
- settings
list. Must include:
acs_count_vars
— ACS count variable names pums_year
— PUMS target year pums_dataset
— ACS dataset type study_unit
— study unit type Modified by reference: no.
- study_unit
character. Study unit(s) to adjust: 'household', 'person', or both. Default: settings$study_unit.
Value
data.table. Adjusted ACS counts. Same schema as input. Columns:
bg_geoid
county_fips
ref_count_h
ref_count_p
Rows: one per block group. Keys: (bg_geoid).
Details
Computes adjustment factors using county-level ACS for the target year.
Only reference counts are used for adjustment, not PUMS, to avoid circularity.
Handles both 'household' and 'person' units, merging and adjusting as needed.
Checks that adjusted totals match county-level ACS within tolerance; errors if not.
Cleans up temporary columns before returning a copy.
Returns a data.table copy; does not modify by reference.
Settings
acs_count_vars (direct): ACS count variable names. Default from config/settings.json.
pums_year (direct): PUMS target year. Default from config/settings.json.
pums_dataset (direct): ACS dataset type. Default from config/settings.json.
study_unit (direct): Study unit type. Default from config/settings.json.
See also
get_county_fips(), get_state_fips(), calc_sample_plan_counts()
Other weighting adjustment:
adjust_pums_to_reference(),
adjust_target_to_study_zones(),
adjust_unrelated_per_wts(),
adjust_unrelated_pums(),
blend_initial_weights(),
calc_alpha(),
calc_initial_weights(),
calc_uwe(),
force_balance_pums_weights()
Examples
## Not run:
acs_counts <- data.table(bg_geoid = "12345", county_fips = "001", ref_count_h = 100, ref_count_p = 250)
settings <- list(acs_count_vars = c("ref_count_h", "ref_count_p"),
pums_year = 2020,
pums_dataset = "acs5",
study_unit = "household")
adjusted <- adjust_ref_counts_dataset(acs_counts, settings, study_unit = c('household', 'person'))
#> Error in get("acs_count_vars", settings)[[sunit]]: subscript out of bounds
## End(Not run)