Repository navigation
Conversation
A contribution at working age s now grows by (1 + g_NDC) in each period from s + 1 through the retirement period R, in which the first benefit is paid, rather than through R - 1. This matches the timing of private savings (a stock carried into a period earns that period's return) and the timing the conversion coefficient already assumed: dir_R values the balance in period R without discounting the first payment, so with the discount rate equal to the credited rate the benefits are now actuarially fair at the notional rate. Applies to NDC_1dim_loop, NDC_2dim_loop, NDC_3dim_loop (and so to the notional band of the hybrid system) and to deriv_NDC_loop. Updates the NDC test expectations (each by exactly one period of the credited rate) and adds a fairness test. Also fixes the NDC labor-supply derivative in the docs and in the deriv_NDC docstring, which had the exponent u - s and the condition s < R - 1; it is (1 + g_NDC)^(R - s) for every s < R. Bumps the version to 0.24.7. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1287 +/- ##
=======================================
Coverage 79.81% 79.81%
=======================================
Files 24 24
Lines 6811 6811
=======================================
Hits 5436 5436
Misses 1375 1375
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
This PR changes the NDC crediting window so that notional balances are credited through the retirement period R, not through R − 1. It also fixes the NDC labor-supply derivative in the docs. It bumps the version to 0.24.7. Model results change for the
Notional Defined ContributionandHybrid DB-NDCsystems.It came up while reviewing the funded defined contribution (FDC) pillar (#1283–#1286). Those PRs credit FDC accounts through R, and merging this first makes NDC and FDC use the same timing.
The problem
Under the old formula, a contribution at working age s grew by (1 + g_NDC) in periods s + 1 … R − 1 only. The conversion coefficient, however, values the balance in period R: its annuity factor dir_R doesn't discount the first payment, made in R, and discounts later payments from R. So the balance was one period short of the date it is valued at. With the discount rate equal to the credited rate,
k_ret = 0, andindR = 0, the expected present value of benefits at R was the notional balance divided by (1 + g_NDC,R), not the balance itself.Crediting through R also matches the household's problem. There, a stock carried from R − 1 into R earns period R's return, just as private savings b do. A funded account has to use this timing, because its assets earn a return in period R that must go to someone.
Changes
NDC_1dim_loop,NDC_2dim_loopandNDC_3dim_loopstart the growth factor at 1 + g_NDC in the retirement period. Each loop reads that rate from the same calendar path and clipping it uses for the other periods. The hybrid system's notional band uses these loops, so it changes the same way.deriv_NDC_loopnow uses (1 + g_NDC)^(R − s), consistent with the benefit formula.government.md).eqn:ndc_deriv. It showed the exponent (u − s) and the condition s < R − 1, which matched neither the benefit formula nor the code. It now reads τ_p w e (1 + g_NDC)^(R − s) δ_R for every s < R, with a note that the code evaluates it at a single credited rate and conversion coefficient. The same fix is in thederiv_NDCdocstring.NDC_amount,NDC_1dim_loopandNDC_3dim_loopdescribe the new window.ogcore/__init__.py,pyproject.tomlanduv.lock.Tests
Updated expected values. The nine NDC tests that hard-code values were updated. I checked that each new value is exactly one more period of the credited rate, not just whatever the code now outputs:
'LR GDP'.The hand calculation in
test_NDC_1dim_loop_time_varying_creditnow multiplies through t_birth + R.New test.
test_NDC_fair_at_credited_ratesets the conversion coefficient to the inverse of the survival-weighted annuity factor at the credited rate. It checks that the expected present value of benefits at R equals contributions accumulated through R. The old timing fails this test by exactly 1 + g.Unit tests:
test_pensions.py,test_household.py,test_aggregates.py,test_parameters.pyandtest_tax.pypass (286 tests).Local tests:
test_run_TPI_pension_regime, all four cases including the two NDC regime cases, passes.Non-local
test_SS.pyandtest_TPI.py: 57 pass. The 5 failures aretest_SS_fsolvecases that also fail on master; they don't use NDC.Docs: the API reference builds with
-W.Size of the change
In the small test model (
tests/testing_params.json, S = 40, so 2-year periods), an NDC steady state withtau_p = 0.16changes as follows:The resource constraint error is about 1e-9 under both. With the default one-year periods, benefits rise by about one period's credited rate, roughly 3% under the default
'LR GDP'rate.🤖 Generated with Claude Code