Respect recorded state pension for new-SP cohort#75
Open
vahid-ahmadi wants to merge 1 commit into
Open
Conversation
`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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #59
Problem
person_state_pensionignored the FRS-recordedperson.state_pensionfor the new SP cohort (age belowbasic_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 £946pensioner_coupledivergence 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:
person.state_pension > 0: return it scaled bynew_state_pension_weekly / baseline_new_sp_weekly(×1.0 in baseline, so the recorded amount is preserved; reforms still flow through).person.state_pension == 0: returnnew_state_pension_weekly × 52.This threads a new
baseline_new_sp_weeklythroughSimulation::new/new_with_baseline_sp/branch/calculate_benunit/person_state_pension, exactly parallel to the existingbaseline_old_sp_weeklyfield. All call sites were updated:src/main.rs, the labour-supply derivative simulations, internal tests, andbenches/branch.rs.Tests
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.param_state_pension_new_weekly(state_pension = 0) still passes — the reform fallback path is unchanged.cargo buildandcargo testboth pass (191 tests, 0 failures).🤖 Generated with Claude Code