Skip to content

Funded defined contribution pillar, part 3: transition path - #1285

Merged
rickecon merged 4 commits into
PSLmodels:masterfrom
jdebacker:FDC_TPI
Nov 21, 2026
Merged

rickecon merged 4 commits into
PSLmodels:masterfrom
jdebacker:FDC_TPI

Conversation

@jdebacker

@jdebacker jdebacker commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

This PR is stacked on #1283 (FDC part 1) and #1284 (part 2), so their commits appear here too. Review only the last commit, "Solve the time path with the funded defined contribution pillar", until those merge.

This is part 3 of 4 for the funded defined contribution (FDC) pillar: the transition path. With fdc_tau = 0 (the default) results are unchanged.

What changes

  • Household problem on the path. household.get_fdc now handles a cohort's remaining lifetime ("TPI" and "TPI_scalar"). Each cohort's account is credited, and its annuity priced, on the r_p and wage paths the cohort foresees. The labor-FOC wedge (household.fdc_labor_wedge) works on partial lifetimes, with the cohort's own mortality read along its diagonal.
  • Initial conditions. Households alive at t=0 start from the FDC holdings of their age in the baseline steady state, which are zero if the baseline has no FDC pillar. Like private savings, these are scaled for the period-0 population, and they are stored on p as n_preTP is. Households already retired at t=0 re-annuitize their remaining balances on the new path, so the annuity pool stays closed with no government residual.
  • Aggregates.
    • pensions.fdc_tpi builds the (T, S, J) accounts cohort by cohort.
    • aggregates.get_F(…, "TPI") gives the fund's assets, which enter both get_K_splits calls as B + F.
    • FDC balances of members who die before retirement are added to BQ, and immigrants' FDC claims enter I_d and I.
    • Consumption reflects the FDC net flow.
  • Outputs. The time-path output adds F, fdc_contrib, fdc_benefits and fdc_holdings. The steady-state output adds fdc_R, the age at which balances are annuitized; it's used to build initial holdings.
  • Guard removed. The NotImplementedError guard in run_TPI is gone.

Checks (small model, tests/testing_params.json)

Run F at t=0 F at end of path F in the steady state max RC error
Baseline, fdc_tau = 0.05 0.271 0.2446 0.2446 5.5e-5
Reform introducing FDC (fdc_tau = 0.05) from a no-FDC baseline 0 0.2445 0.2445 7.1e-5
  • Fund identity. It holds in every period of the path to about 1e-8: Σ ω·(start-of-period balances) = (1 + r_p) F − FDC bequests. A unit test checks this on synthetic paths.
  • Consistency. The time-path accounts equal each cohort's own lifetime accounts, both for cohorts born on the path and for cohorts alive at t=0.
  • Pre-existing failure, same on master. With FDC off, this small model's time path misses RC_TPI (1.37e-4 at period 20) on upstream master too, identically. The new local test therefore runs that no-FDC baseline with the checks off and checks only the FDC runs.

Tests

  • Unit tests (pass): test_household.py, test_aggregates.py, test_pensions.py, test_parameters.py, test_tax.py.
  • New local test (passes): test_run_TPI_funded_defined_contribution.
  • Non-local test_SS.py and test_TPI.py: everything passes except test_SS_fsolve cases, all of which also fail on upstream master.

Decision to note

When initial_wealth_ratio rescales initial private savings, initial FDC holdings are not rescaled.

🤖 Generated with Claude Code

@codecov-commenter

codecov-commenter commented Nov 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.41096% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.10%. Comparing base (f21e911) to head (e9c62d9).

Files with missing lines Patch % Lines
ogcore/TPI.py 72.09% 12 Missing ⚠️
ogcore/household.py 88.23% 6 Missing ⚠️
ogcore/pensions.py 96.38% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1285      +/-   ##
==========================================
+ Coverage   79.85%   80.10%   +0.25%     
==========================================
  Files          24       24              
  Lines        7028     7208     +180     
==========================================
+ Hits         5612     5774     +162     
- Misses       1416     1434      +18     
Flag Coverage Δ
unittests 80.10% <90.41%> (+0.25%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
ogcore/SS.py 92.26% <ø> (ø)
ogcore/aggregates.py 100.00% <100.00%> (ø)
ogcore/fiscal.py 100.00% <100.00%> (ø)
ogcore/pensions.py 74.79% <96.38%> (+2.07%) ⬆️
ogcore/household.py 90.96% <88.23%> (-0.27%) ⬇️
ogcore/TPI.py 81.48% <72.09%> (-0.71%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jdebacker
jdebacker marked this pull request as ready for review November 15, 2026 08:07
Each cohort's FDC account is computed from the r_p and wage paths it
foresees (pensions.fdc_tpi, household.get_fdc on partial lifetimes),
with the annuity priced on that path. Households alive at t=0 start
from the baseline steady state's FDC holdings (zero if the baseline
had none), scaled for the period-0 population; retirees re-annuitize
on the new path. Fund assets enter get_K_splits in every period,
pre-retirement balances of the deceased are bequeathed, and
immigrants arrive with their age's FDC claims. TPI output adds F and
FDC profiles; SS output adds fdc_R.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jdebacker and others added 3 commits November 19, 2026 18:30
…time path

Brings in the r_fdc wedge and the FDC fund reserve from FDC_SS and
extends them to the time path, following the steady state:

- Accounts earn r_fdc = r_p - r_fdc_wedge in each period with the wedge
  each cohort faces (pensions.fdc_wedge_path), including balances
  carried into period 0, in both pensions.fdc_tpi and
  household.get_fdc. Bequeathed balances are credited r_fdc
  (pensions.fdc_bequeathable_tpi).
- aggregates.get_fdc_spread and get_fdc_fund_reserves take
  method='TPI'. The reserve starts from the baseline steady-state
  reserve, follows its flow identity between zero and
  fdc_fund_reserve_max_GDPratio times GDP, and adds to domestic
  savings. Because it can approach its steady state more slowly than
  the time path converges, the payment in period T - 1 settles any
  remaining gap (new argument Z_T), and run_TPI logs a warning if the
  settlement exceeds 0.1 percent of GDP.
- Net FDC fund revenue enters the budget through fiscal.get_TR and a
  new optional argument of fiscal.D_G_path.
- The time-path output adds fdc_spread, fdc_fund_reserves,
  fdc_fund_revenue, and fdc_fund_transfer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Applies the FDC_SS change (no steady-state reserve) and extends it to
the time path: the reserve starts at zero, accumulates the spread and
its own return r_p with no floor (a negative wedge runs a deficit) and
with reserves above fdc_fund_reserve_max_GDPratio times GDP paid to the
government, until the end of period tG1 - 1, when the whole balance is
paid to the government (or the deficit covered by it). From tG1 on the
reserve is zero and the spread goes to the government each period.

This replaces the settlement in period T - 1, which could not close the
resource constraint because a slow-moving reserve kept the whole
economy away from its steady state at T.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in the merged FDC_SS (PSLmodels#1284), Rick's fiscal.py docstring
updates, and the uv.lock update. Resolves conflicts in
ogcore/aggregates.py, tests/test_aggregates.py, and CHANGELOG.md by
keeping the FDC_TPI versions, which contain the steady-state FDC fund
reserve code from FDC_SS plus its time path. Updates the D_G_path
docstring for the payout of the reserve at tG1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jdebacker
jdebacker requested a review from rickecon November 20, 2026 23:14
@rickecon

Copy link
Copy Markdown
Member

@jdebacker. This all looks very good. Merging now.

@rickecon
rickecon merged commit fcdc037 into PSLmodels:master Nov 21, 2026
8 checks passed
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.

3 participants