Prepare ACS income fractions for imputation
prepare_acs_income.RdLoads and processes ACS household income data, aligning block group income distributions to survey bins for use in imputation models. Use to generate block group-level income fractions for model fitting and prediction.
Arguments
- hhs
data.table. Household records with block group GEOID. Required columns:
bg_geoid— block group GEOID Rows: one per household. Keys: ( bg_geoid). Modified by reference: no (returns copy).
- survey_upper
numeric vector. Upper bounds for survey income bins (must match ACS labels).
- settings
list. Settings object with ACS configs. Required keys:
acs_tables[['hh_income']]— ACS table name acs_year— ACS year
Value
data.table. Block group-level ACS income fractions. Columns:
bg_geoid— block group GEOID f_*— fraction of households in each income bin (e.g., f_0_24999) Rows: one per block group. Keys: (bg_geoid).
Details
Fetches ACS household income data using settings (table and year).
Relabels ACS income bins to match survey upper bounds using regex and value_labels.
Tabulates block group counts and converts to fractions for each income bin.
Fills zero fractions to avoid rank deficiency in modeling.
Returns a data.table with block group GEOID and income fraction columns (e.g.,
f_0_24999).Assumes ACS data is available and settings are correct; errors if required columns are missing.
Settings
acs_tables[['hh_income']](direct): ACS table for household income. Default from settings.acs_year(direct): ACS year. Default from settings.
See also
impute_income_pnta, prep_hhs_for_income_imputation
Other imputation utilities:
calculate_acs_proportions(),
get_acs_ethnicity(),
get_acs_race(),
get_hh_person_sums(),
impute_ethnicity(),
impute_gender(),
impute_income_nonrelatives(),
impute_income_pnta(),
impute_race(),
make_binary(),
prep_hhs_for_income_imputation(),
prepare_ethnicity_labels(),
prepare_ethnicity_survey_data(),
prepare_impute_targets(),
prepare_income_fit_dt(),
prepare_persons_dt(),
update_hh_income_imputed()