Skip to content

Respect recorded state pension for new-SP cohort#75

Open
vahid-ahmadi wants to merge 1 commit into
mainfrom
vahid/state-pension-new-sp
Open

Respect recorded state pension for new-SP cohort#75
vahid-ahmadi wants to merge 1 commit into
mainfrom
vahid/state-pension-new-sp

Conversation

@vahid-ahmadi

Copy link
Copy Markdown
Contributor

Closes #59

Problem

person_state_pension ignored the FRS-recorded person.state_pension for the new SP cohort (age below basic_sp_min_age) and always returned the full parameter rate × 52. The basic SP branch already used the correct scaled-recorded-amount pattern. This overstated state pension on households whose recorded amounts differ from the full new-SP rate — e.g. the £946 pensioner_couple divergence the PR #53 parity harness surfaced (two pensioners recorded at £11,500 each; Rust returned 2 × £230.25 × 52 = £23,946 vs Python's £23,000).

Fix

Mirror the basic-SP pattern for the new-SP branch:

  • If person.state_pension > 0: return it scaled by new_state_pension_weekly / baseline_new_sp_weekly (×1.0 in baseline, so the recorded amount is preserved; reforms still flow through).
  • If person.state_pension == 0: return new_state_pension_weekly × 52.

This threads a new baseline_new_sp_weekly through Simulation::new / new_with_baseline_sp / branch / calculate_benunit / person_state_pension, exactly parallel to the existing baseline_old_sp_weekly field. All call sites were updated: src/main.rs, the labour-supply derivative simulations, internal tests, and benches/branch.rs.

Tests

  • New unit test new_sp_recorded_amount_respected: asserts the recorded amount (£11,500) is returned unchanged in the baseline for a new-SP-cohort person, distinct from the full-rate fallback.
  • Existing param_state_pension_new_weekly (state_pension = 0) still passes — the reform fallback path is unchanged.
  • cargo build and cargo test both pass (191 tests, 0 failures).

🤖 Generated with Claude Code

`person_state_pension` ignored the recorded `person.state_pension` for the
new-SP cohort (age below `basic_sp_min_age`) and always returned the full
parameter rate × 52, overstating SP on households whose recorded amounts
differ from the full new-SP rate (e.g. the £946 pensioner_couple divergence
in the parity harness).

Mirror the basic-SP scaled-recorded-amount pattern: return the recorded
amount scaled by `new_state_pension_weekly / baseline_new_sp_weekly` when an
amount is recorded, falling back to the full rate × 52 only when nothing is
recorded. Threads `baseline_new_sp_weekly` through `Simulation::new` /
`new_with_baseline_sp` / `branch` / `person_state_pension` parallel to the
existing `baseline_old_sp_weekly` field, updating all call sites (src, tests,
labour-supply derivative sims, and benches/branch.rs).

Adds a unit test asserting the recorded amount is returned unchanged in the
baseline regardless of the new-SP parameter rate; the existing
`param_state_pension_new_weekly` test (state_pension = 0) still passes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

State pension: respect recorded amount for 'new SP' cohort (mirror old-SP scaling)

1 participant