Skip to content

Add opt-in cliff impact outputs to reform analyses #376

@anth-volk

Description

@anth-volk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions