Skip to content

Conversation

@nikhilwoodruff
Copy link
Collaborator

@nikhilwoodruff nikhilwoodruff commented Jan 2, 2026

Summary

Adds two new single-simulation output types for economic analysis:

Poverty - calculates headcount and rates for:

  • UK: absolute BHC, absolute AHC, relative BHC, relative AHC
  • US: SPM, SPM deep

Inequality - calculates:

  • Gini coefficient (weighted)
  • Top 10%, top 1%, bottom 50% income shares

Both support demographic filtering via filter_variable (e.g. child poverty). Helper functions calculate_uk_poverty_rates, calculate_us_poverty_rates, calculate_uk_inequality, calculate_us_inequality provide convenient wrappers. Both economic_impact_analysis functions now include poverty and inequality in results.

Test plan

  • Unit tests for Poverty output with weighted calculations and filtering
  • Unit tests for Gini coefficient calculation
  • Unit tests for income share calculations
  • Existing aggregate tests still pass

Adds a new Poverty output type that calculates headcount, total population, and poverty rate for a single simulation. Supports:

- UK: 4 poverty types (absolute/relative × BHC/AHC)
- US: 2 poverty types (SPM, SPM deep)
- Demographic filtering (e.g. child poverty via is_child filter)
- Entity mapping (household/SPM unit poverty mapped to person level)

Also adds calculate_uk_poverty_rates and calculate_us_poverty_rates helper functions, and integrates poverty into economic_impact_analysis for both countries.
Adds a new Inequality output type that calculates:
- Gini coefficient (weighted)
- Top 10%, top 1%, and bottom 50% income shares

Uses equiv_hbai_household_net_income for UK, household_net_income for US.
Integrates into economic_impact_analysis for both countries.
@nikhilwoodruff nikhilwoodruff changed the title Add poverty output type for single-simulation analysis Add poverty and inequality output types Jan 2, 2026
@nikhilwoodruff nikhilwoodruff merged commit 4f1f237 into main Jan 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants