Recode household income to broad bins
get_income_broad.RdHarmonizes household income categories between survey and ACS data by mapping detailed and followup bins to a unified income_broad variable. Use in weighting pipelines to ensure consistent income stratification.
Arguments
- households
data.table with required columns:
income_detailed
— detailed income bin income_followup
— followup income bin Additional columns as needed for household attributes Rows: one per household. Modified by reference: no.
- value_labels
data.table with required columns:
variable
— variable name (e.g., income_detailed) value
— bin code label
— bin label Rows: one per bin. Modified by reference: no.
- settings
list. Must include project settings for bin mapping.
- max_income_bin
integer. Maximum income bin. Default: from settings or value_labels.
Value
data.table with columns:
All input columns
income_broad
— recoded broad income bin income_broad_label
— label for broad bin Rows: one per household.
Details
Joins income_detailed and income_followup columns to broad bins using value_labels and settings.
Handles missing and top-coded values; assigns 999 for missing or unallocatable cases.
Creates new value labels for income_broad and appends to value_labels.
Returns a copy; does not modify by reference.
Assumes valid input tables and settings; errors if missing or bins are not represented.
Example mapping:
income_detailed income_followup income_broad Less than $15,000 Under $25,000 1 $15,000-$24,999 Under $25,000 1 $25,000-$34,999 $25,000-$49,999 2 $35,000-$49,999 $25,000-$49,999 2 $50,000-$74,999 $50,000-$74,999 3 $75,000-$99,999 $75,000-$99,999 4 $100,000-$149,999 $100,000-$249,999 999 $150,000-$199,999 $100,000-$249,999 999 $200,000-$249,999 $100,000-$249,999 999 $250,000 or more $250,000 or more 999
See also
get_income_bounds
scripts/weighting/get_income_broad.R
Other weighting pipeline:
aggregate_targets(),
calc_day_weights(),
calc_linked_trip_weights(),
calc_person_weights(),
calc_sample_plan_counts(),
calc_tour_weights(),
calc_trip_weights(),
create_ie_adjustment_data(),
create_target_update_table(),
format_income_bins(),
get_day_groups(),
get_income_broad_xwalk(),
prepare_zone_groups(),
update_daypat_seed(),
update_daypat_targets(),
update_income_broad_labels(),
update_rate_report(),
update_targets()