Apply replacement_rate_adjust to every pension system - #1201
Open
marcelolafleur wants to merge 1 commit into
Open
Apply replacement_rate_adjust to every pension system#1201marcelolafleur wants to merge 1 commit into
marcelolafleur wants to merge 1 commit into
Conversation
marcelolafleur
force-pushed
the
pension-replacement-rate-adjust
branch
from
August 11, 2026 20:16
55838c9 to
ed31a6d
Compare
marcelolafleur
marked this pull request as ready for review
August 11, 2026 20:33
marcelolafleur
marked this pull request as draft
August 11, 2026 21:11
marcelolafleur
marked this pull request as ready for review
August 11, 2026 21:12
This was referenced Aug 11, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1201 +/- ##
==========================================
+ Coverage 72.74% 72.78% +0.03%
==========================================
Files 22 22
Lines 5768 5783 +15
==========================================
+ Hits 4196 4209 +13
- Misses 1572 1574 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
Fixes #1200.
replacement_rate_adjustis a table of multipliers on pension benefits, one per year and income group. It lets a country phase benefits down over time.It was only read inside
SS_amount, so it worked under US-Style Social Security and did nothing at all under Defined Benefits, Notional Defined Contribution and Points System. Setting it under those three changed nothing and gave no warning.pension_amountnow applies it to the other three systems as well.The only fiddly part is looking up the right year. In the steady state there is one year, so the multiplier is the last row of the table. Along the transition the model computes a block of years at once, and each row of that block is a different year — the block starts at year
t, so its first row needs the multiplier for yeart, its second row yeart + 1, and so on. A small helper does that lookup and returns the multipliers shaped to line up with the benefits array. This is whatSS_amountwas already doing for US-Style; the helper does the same for the rest.SS_amountitself is unchanged, so US-Style results cannot move.With this fix, thame call, with the multiplier halved:
Tests
test_replacement_rate_adjust_applies_to_every_system: halving the multiplier must halve benefits, under all four systems. Fails on master for DB, NDC and PS.test_replacement_rate_adjustment_indexes_by_cohort_year: checks the year lookup: on the transition, row n of the block must get the multiplier for yeart + n, and the steady state must get the last row. Using one year's multiplier for the whole block would still pass a test with a flat table, and would quietly cancel out a phase-down. The existingtest_pension_amountsets the table to all ones, so it cannot catch this.test_pensions.py,test_tax.pyandtest_aggregates.pypass, 122 total.cc: @jdebacker @rickecon