Summary
Add an opt-in cliff impact output to US and UK reform analyses, matching the legacy simulation API shape:
{
"baseline": {"cliff_gap": ..., "cliff_share": ...},
"reform": {"cliff_gap": ..., "cliff_share": ...}
}
Motivation
The simulation API supported cliff impact outputs on policyengine.py < 1. The new v4 analysis path needs a compatible way to materialize and return cliff impact calculations without making the expensive cliff variables part of every default simulation output.
Proposed behavior
- Add a public cliff impact output helper.
- Materialize
cliff_gap, is_on_cliff, and is_adult only when requested.
- Expose
include_cliff_impacts on US and UK economic impact analysis.
- Preserve existing labor supply response extra-variable behavior.
Validation notes
Local parity validation against the legacy simulation API on pinned package/data versions found a nonzero sampled cliff case and matched the legacy aggregate exactly:
cliff_gap: 3,952,908,577.8710938
cliff_share: 0.0060240964024626835
Focused tests also passed locally:
pytest tests/test_cliff_impact.py tests/test_cliff_impact_analysis.py
pytest tests/test_labor_supply_response.py tests/test_uk_analysis.py tests/test_uk_program_statistics.py
ruff check on changed source/test files
Summary
Add an opt-in cliff impact output to US and UK reform analyses, matching the legacy simulation API shape:
{ "baseline": {"cliff_gap": ..., "cliff_share": ...}, "reform": {"cliff_gap": ..., "cliff_share": ...} }Motivation
The simulation API supported cliff impact outputs on
policyengine.py < 1. The new v4 analysis path needs a compatible way to materialize and return cliff impact calculations without making the expensive cliff variables part of every default simulation output.Proposed behavior
cliff_gap,is_on_cliff, andis_adultonly when requested.include_cliff_impactson US and UK economic impact analysis.Validation notes
Local parity validation against the legacy simulation API on pinned package/data versions found a nonzero sampled cliff case and matched the legacy aggregate exactly:
cliff_gap:3,952,908,577.8710938cliff_share:0.0060240964024626835Focused tests also passed locally:
pytest tests/test_cliff_impact.py tests/test_cliff_impact_analysis.pypytest tests/test_labor_supply_response.py tests/test_uk_analysis.py tests/test_uk_program_statistics.pyruff checkon changed source/test files