Fix the Defined Benefits and Points System pensions so they can actually run#1167
Open
marcelolafleur wants to merge 6 commits into
Open
Fix the Defined Benefits and Points System pensions so they can actually run#1167marcelolafleur wants to merge 6 commits into
marcelolafleur wants to merge 6 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1167 +/- ##
==========================================
- Coverage 73.37% 73.29% -0.09%
==========================================
Files 21 21
Lines 5374 5410 +36
==========================================
+ Hits 3943 3965 +22
- Misses 1431 1445 +14
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Pre-time-path wages are anchored to the period-0 wage of the current path (trend growth is handled by the de-trending in the benefit formulas); labor comes from the model's initial condition. The bulk (T,S,J) evaluation reconstructs each retiree's benefit from their own cohort's wage history so aggregates match household behavior exactly.
This was referenced Jul 10, 2026
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.
The non-US pension systems in
pensions.pycrash when used with a real Specifications object. We found this calibrating OG-BRA: Brazil's pension system (RGPS) is a defined benefits scheme, so OG-BRA is the first country model to usepension_system = "Defined Benefits"— and it crashes on the first solve. Same family of bugs as the Points System crash reported in #1075.The cause is that these code paths were never updated after some parameters became time-varying: the functions pass arrays where the numba loops expect scalars, and scalars where they expect arrays. The existing tests didn't catch this because they feed the loops pre-cleaned inputs from mock objects instead of a real Specifications object.
Three changes (the third was added after testing a full transition path downstream):
default_parameters.jsonyet — so it remains unusable for now.DB_3dim_loop, built from each cohort's own wage history so aggregates match household behavior; it reproduces the steady-state solution to machine precision on a constant path).Fixes #1075. Part of #1014.
Tested: full pension and tax suites pass (71 tests); the DB steady state solves. Downstream check: the OG-BRA Defined Benefits calibration solves both the baseline and a reform transition path against this branch, passes the resource-constraint check on both, and hits its pension spending target to four decimals.
cc @rickecon @jdebacker