Update household income with imputed nonrelative income
update_hh_income_imputed.RdUpdates household income by adding imputed nonrelative income, recalculating bounds, and re-binning into income categories using crosswalks and overlap logic. Use to produce final household income labels for analysis and reporting.
Arguments
- hh_income_pnta
data.table. Household income table. Required columns:
hh_id— household identifier income_imputed_pnta— imputed income from pnta income_imputed_pnta_label— income label Rows: one per household. Keys: ( hh_id). Modified by reference: no (returns copy).
- persons_nr
data.table. Person-level data with imputed nonrelative income. Required columns:
hh_id— household identifier nonrelative_income— imputed nonrelative income
- value_labels
data.table. Value labels for variables. Required columns:
variable— variable name label— value label value<integer/character> — coded value
Value
data.table. Updated household income. Columns:
hh_id— household identifier income_imputed<integer/numeric> — final imputed income binincome_imputed_label— final income label Rows: one per household. Keys: ( hh_id).
Details
Copies input household income table to avoid reference modification.
Uses get_income_bounds to compute lower and upper bounds for each income label.
Adds imputed nonrelative income to household bounds.
Uses get_income_broad_xwalk and find_income_overlaps to re-bin revised income ranges into broad income categories:
Crosswalks income bins using value_labels and settings.
Finds overlapping bins and assigns followup labels based on maximum overlap.
Joins bin labels back to household income and drops intermediate columns.
Returns a data.table with hh_id, final imputed income, and label.
Assumes value_labels and crosswalks are current; errors if binning fails or overlaps are ambiguous.
Dependencies
get_income_bounds: computes lower/upper bounds for income labels
get_income_broad_xwalk: crosswalks income bins to broad categories
find_income_overlaps: assigns bin labels based on overlap
See also
get_income_bounds, get_income_broad_xwalk, find_income_overlaps
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_acs_income(),
prepare_ethnicity_labels(),
prepare_ethnicity_survey_data(),
prepare_impute_targets(),
prepare_income_fit_dt(),
prepare_persons_dt()