Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Adds tests of the FDC accounts against hand calculations, the fairness of the annuity, the earnings band, a finite-difference check of the accrual derivative, cohort-specific contribution rates, and calendar-indexed returns.
- Solves the steady state with the FDC pillar. Households pay contributions and receive annuity benefits through their budget constraint (kept out of `net_taxes`, so FDC flows are neither government revenue nor outlays). The labor first order condition values the annuity a contribution buys, through `household.fdc_labor_wedge`, so contributions are not treated as a pure tax. The fund's assets (`aggregates.get_F`) add to domestic savings in the capital market, the balances of members who die before retirement are bequeathed, and immigrants arrive with the FDC holdings of their age. The steady-state output adds `F`, `fdc_contrib`, `fdc_benefits`, `fdc_holdings`, `agg_fdc_contrib`, and `agg_fdc_benefits`. With `fdc_tau = 0` (the default) results are unchanged. `TPI.run_TPI` raises `NotImplementedError` when the pillar is on, until the time path is added.
- Adds `household.fdc_active`, `household.get_fdc`, `household.fdc_net_flow`, `household.fdc_labor_wedge`, `aggregates.get_F`, `pensions.fdc_holdings`, `pensions.fdc_bequeathable`, and `pensions.fdc_survivor_claims`, with tests of the labor FOC wedge against its closed form on an Euler-equation consumption path, the fund's flow identity, and a steady-state solution with the pillar on.
- Accounts for the spread between the portfolio return r_p and the FDC return r_fdc = r_p - r_fdc_wedge, which the steady state previously dropped, so that a nonzero `r_fdc_wedge` broke the resource constraint. The fund invests the balances it owes households (`aggregates.get_F`, credited r_fdc, including the balances bequeathed by members who die before retirement, which `pensions.fdc_bequeathable` now credits at r_fdc instead of r_p) and keeps the spread (`aggregates.get_fdc_spread`) as a pension reserve that earns r_p and adds to domestic savings (`aggregates.get_pension_reserves`). The new parameter `pension_reserve_max_GDPratio` (default 0.5, range 0.2 to 0.8) caps the reserve as a share of GDP; reserves above the cap are paid to the government as pension reserve revenue, a new optional argument of `fiscal.get_G_ss` and `fiscal.get_TR` that is not tax revenue. The reserve also has a floor of zero: at the end of any period in which it would fall below zero (as with a negative wedge), the government transfers enough to the reserve that it begins the next period at zero or above, a pension reserve transfer that is netted against the revenue in the budget constraint. `pensions.fdc_bequeathable` now takes `r_p`, and `pensions.fdc_wedge_ss` returns the steady-state wedge by age. The steady-state output adds `fdc_spread`, `pension_reserves`, `pension_reserve_revenue`, and `pension_reserve_transfer`. Adds tests of the reserve rule and steady-state solutions with a nonzero wedge, with the reserve below its ceiling, at its ceiling, and at its floor.

## [0.24.6] - 2026-11-15

Expand Down
3 changes: 2 additions & 1 deletion docs/book/content/api/aggregates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ogcore.aggregates
------------------------------------------

.. automodule:: ogcore.aggregates
:members: get_L, get_I, get_B, get_F, get_BQ, get_RM, get_C, revenue,
:members: get_L, get_I, get_B, get_F, get_fdc_spread,
get_pension_reserves, get_BQ, get_RM, get_C, revenue,
get_payroll_tax_revenue, get_r_p, resource_constraint, get_capital_outflows,
get_K_splits, get_ptilde
2 changes: 1 addition & 1 deletion docs/book/content/api/pensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ ogcore.pensions
deriv_NDC_loop, delta_ret_loop, PS_1dim_loop, PS_2dim_loop, DB_1dim_loop,
DB_2dim_loop, DB_3dim_loop, NDC_1dim_loop, NDC_2dim_loop,
FDCLifetime, fdc_earn_bands, fdc_mort_rates, fdc_annuity_factor_loop,
fdc_lifetime_loop, fdc_lifetime, fdc_ss, fdc_holdings,
fdc_lifetime_loop, fdc_lifetime, fdc_ss, fdc_holdings, fdc_wedge_ss,
fdc_bequeathable, fdc_survivor_claims
30 changes: 26 additions & 4 deletions ogcore/SS.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,14 @@ def inner_loop(outer_loop_vars, p, client, scattered_p=None):
L = aggr.get_L(nssmat, p, "SS")
B = aggr.get_B(bssmat, p, "SS", False)
F = aggr.get_F(fdc, p, "SS")
# pension reserve the fund holds beyond the balances it owes, from
# the spread between r_p and r_fdc, capped at a share of GDP
Z_pen, Psi, Phi = aggr.get_pension_reserves(
r_p, aggr.get_fdc_spread(fdc, p, "SS"), Y, p, "SS"
)
# net pension reserve revenue: payments above the ceiling less
# transfers that keep the reserve from falling below zero
pension_reserve_revenue = Psi - Phi

# Find gov't debt
r_gov = fiscal.get_r_gov(r, p.debt_ratio_ss, p, "scalar", t=-1)
Expand Down Expand Up @@ -567,9 +575,10 @@ def inner_loop(outer_loop_vars, p, client, scattered_p=None):
K_demand_open_vec[-1] = firm.get_K(
p.world_int_rate[-1], w_open, L_M, p, "SS", -1
)
# the FDC fund's assets add to domestic savings
# the FDC fund's assets (owed balances and reserve) add to
# domestic savings
K, K_d, K_f = aggr.get_K_splits(
B + F, K_demand_open_vec.sum(), D_d, p.zeta_K[-1]
B + F + Z_pen, K_demand_open_vec.sum(), D_d, p.zeta_K[-1]
)
K_M = max(0.001, K - K_vec.sum()) # make sure K_M > 0
L_vec[-1] = L_M
Expand Down Expand Up @@ -617,7 +626,7 @@ def inner_loop(outer_loop_vars, p, client, scattered_p=None):
# FDC balances of those who die before retirement are bequeathed
new_BQ = aggr.get_BQ(
new_r_p,
bssmat + pensions.fdc_bequeathable(fdc, p),
bssmat + pensions.fdc_bequeathable(fdc, new_r_p, p),
None,
p,
"SS",
Expand Down Expand Up @@ -728,6 +737,7 @@ def inner_loop(outer_loop_vars, p, client, scattered_p=None):
new_borrowing,
debt_service,
p,
pension_reserve_revenue,
)
new_TR = fiscal.get_TR(
Y,
Expand All @@ -740,6 +750,7 @@ def inner_loop(outer_loop_vars, p, client, scattered_p=None):
foreign_aid,
p,
"SS",
pension_reserve_revenue,
)

G_vec = np.zeros(p.M)
Expand Down Expand Up @@ -993,6 +1004,12 @@ def SS_solver(
"SS",
)
Fss = aggr.get_F(fdc_ss, p, "SS")
fdc_spread_ss = aggr.get_fdc_spread(fdc_ss, p, "SS")
(
Zss,
pension_reserve_revenue_ss,
pension_reserve_transfer_ss,
) = aggr.get_pension_reserves(new_r_p, fdc_spread_ss, Yss, p, "SS")
(
Dss,
D_d_ss,
Expand All @@ -1009,7 +1026,7 @@ def SS_solver(
p.world_int_rate[-1], w_open, L_vec_ss[m], p, "SS", m
)
Kss, K_d_ss, K_f_ss = aggr.get_K_splits(
Bss + Fss, K_demand_open_ss.sum(), D_d_ss, p.zeta_K[-1]
Bss + Fss + Zss, K_demand_open_ss.sum(), D_d_ss, p.zeta_K[-1]
)
# Yss = firm.get_Y(Kss, K_g_ss, Lss, p, 'SS')
I_g_ss = fiscal.get_I_g(Yss, Ig_baseline, p, "SS")
Expand Down Expand Up @@ -1255,6 +1272,7 @@ def SS_solver(
new_borrowing,
debt_service,
p,
pension_reserve_revenue_ss - pension_reserve_transfer_ss,
)

# Compute total investment (not just domestic)
Expand Down Expand Up @@ -1404,6 +1422,10 @@ def SS_solver(
"bequest_tax": bq_tax_ss[: p.T, ...],
"pension_benefits": pension_ss[: p.T, ...],
"F": Fss,
"fdc_spread": fdc_spread_ss,
"pension_reserves": Zss,
"pension_reserve_revenue": pension_reserve_revenue_ss,
"pension_reserve_transfer": pension_reserve_transfer_ss,
"fdc_contrib": fdc_contrib_ss,
"fdc_benefits": fdc_benefits_ss,
"fdc_holdings": fdc_holdings_ss,
Expand Down
127 changes: 124 additions & 3 deletions ogcore/aggregates.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,15 @@ def get_F(fdc, p, method):
"""
if fdc is None:
return 0.0
return _fdc_owed_terms(fdc, p, method).sum()


def _fdc_owed_terms(fdc, p, method):
"""
Terms of ``get_F`` by the age s - 1 at which the holdings were
carried out of the previous period (S x J): the balances owed to
households of age s at the start of the period, before its return.
"""
if method != "SS":
raise NotImplementedError(
"FDC fund assets are only computed in the steady state so far"
Expand All @@ -232,11 +241,123 @@ def get_F(fdc, p, method):
imm_extended = np.append(
p.imm_rates[-1, 1:, :], np.zeros((1, p.J)), axis=0
)
F = (
terms = (
fdc.holdings * np.exp(-p.g_y) * p.omega_SS
+ claims * omega_extended * imm_extended
).sum()
return F / (1.0 + p.g_n_ss)
)
return terms / (1.0 + p.g_n_ss)


def get_fdc_spread(fdc, p, method):
r"""
Spread the funded defined contribution (FDC) fund earns on the
balances it owes households. The fund invests the owed balances
$\hat{F}_t$ in the household portfolio, which earns $r_{p,t}$, but
credits the accounts (including those bequeathed by members who die
before retirement) only $r_{fdc} = r_{p} - r_{fdc\_wedge}$. The
difference goes to the pension reserve (``get_pension_reserves``):

.. math::
\hat{\Pi}_{t} = \sum_{s=E+1}^{E+S}\sum_{j=0}^{J}
r_{fdc\_wedge,s}\,\hat{f}_{j,s,t}

where $\hat{f}_{j,s,t}$ are the terms of ``get_F`` owed to members
of age s.

Args:
fdc (pensions.FDCLifetime or None): the accounts by age and
lifetime income group, None when the pillar is off
p (OG-Core Specifications object): model parameters
method (str): 'SS' (the time path is not supported yet)

Returns:
spread (scalar): the spread, 0.0 when the pillar is off
(negative when ``r_fdc_wedge`` is negative)
"""
if fdc is None:
return 0.0
terms = _fdc_owed_terms(fdc, p, method)
# holdings carried out of age s - 1 earn the return of age s
wedge_next = np.append(pensions.fdc_wedge_ss(p)[1:], 0.0)
return float((wedge_next[:, None] * terms).sum())


def get_pension_reserves(r_p, spread, Y, p, method):
r"""
Steady-state pension reserve $\hat{Z}$ of the funded defined
contribution (FDC) fund, the assets it holds beyond the balances
owed to households, the pension reserve revenue $\hat{\Psi}$ it
pays to the government, and the transfer $\hat{\Phi}$ it receives
from the government.

The reserve is invested in the household portfolio and earns
$r_p$, receives the spread $\hat{\Pi}$ (``get_fdc_spread``), and
must lie between zero and ``pension_reserve_max_GDPratio`` times
GDP at the beginning of every period. At the end of each period,
any reserve above the ceiling is paid to the government
($\hat{\Psi}$), and any shortfall below zero is made up by a
transfer from the government ($\hat{\Phi}$), so that

.. math::
(1 + \bar{g}_{n})e^{g_y}\hat{Z} = (1 + \bar{r}_{p})\hat{Z}
+ \hat{\Pi} - \hat{\Psi} + \hat{\Phi},
\quad 0 \leq \hat{Z} \leq \bar{z}\bar{Y},
\quad \hat{\Psi}, \hat{\Phi} \geq 0

Without the ceiling the reserve would settle at
$\hat{Z}^{*} = \hat{\Pi}/[(1 + \bar{g}_{n})e^{g_y} - 1 - \bar{r}_p]$
only when $\bar{r}_p$ is below the growth rate; otherwise it grows
without bound relative to the economy and so stops at the ceiling.
The floor binds when the spread is negative (``r_fdc_wedge`` < 0):
the reserve starts every period at zero and the government covers
the spread each period.

Args:
r_p (scalar): steady-state household portfolio return
spread (scalar): spread on the owed balances, $\hat{\Pi}$
Y (scalar): steady-state GDP
p (OG-Core Specifications object): model parameters
method (str): 'SS' (the time path is not supported yet)

Returns:
(tuple): pension reserve quantities

* Z (scalar): pension reserve $\hat{Z}$ at the beginning
of the period
* revenue (scalar): pension reserve revenue paid to the
government, $\hat{\Psi} \geq 0$
* transfer (scalar): transfer from the government to the
reserve, $\hat{\Phi} \geq 0$
"""
if method != "SS":
raise NotImplementedError(
"Pension reserves are only computed in the steady state so far"
)
r_p = float(np.squeeze(r_p))
Y = float(np.squeeze(Y))
Z_max = max(p.pension_reserve_max_GDPratio * Y, 0.0)
# growth rate less the reserve's return: the share of the reserve
# needed each period to keep pace with the economy, net of earnings
net_growth = (1.0 + p.g_n_ss) * np.exp(p.g_y) - 1.0 - r_p
if spread > 0.0 and net_growth <= 0.0:
# the reserve grows faster than the economy: it reaches the
# ceiling
Z = Z_max
elif spread > 0.0:
Z = spread / net_growth
else:
# a stationary reserve below zero, or one that falls without
# bound: it is held at the floor
Z = 0.0
# the floor and ceiling on the beginning-of-period reserve
Z = min(max(Z, 0.0), Z_max)
# end-of-period payment that keeps the reserve stationary at Z:
# positive above the ceiling (to the government), negative below
# the floor (from the government)
net_payment = spread - net_growth * Z
revenue = max(net_payment, 0.0)
transfer = max(-net_payment, 0.0)
return Z, revenue, transfer


def get_BQ(r, b_splus1, j, p, method, preTP):
Expand Down
21 changes: 20 additions & 1 deletion ogcore/default_parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -4192,7 +4192,7 @@
"description": "Percentage point wedge between the return households earn on savings r_p and the return earned on funded defined contribution (FDC) account balances, r_fdc = r_p - r_fdc_wedge. A positive value means FDC accounts earn less than household savings (for example, because of fund management fees); a negative value means they earn more.",
"section_1": "Fiscal Policy Parameters",
"section_2": "Government Pension Parameters",
"notes": "Only used when fdc_tau is positive. May vary over time: set value for base year, click '+' to add value for next year. All future years not specified are set to last value entered. A single value is held constant over the time path (it is not indexed to trend growth). The wedge that applies to an FDC account is the one the account holder's cohort faces in each period. Changes by birth cohort are entered through pension_regimes with a single number.",
"notes": "Only used when fdc_tau is positive. May vary over time: set value for base year, click '+' to add value for next year. All future years not specified are set to last value entered. A single value is held constant over the time path (it is not indexed to trend growth). The wedge that applies to an FDC account is the one the account holder's cohort faces in each period. Changes by birth cohort are entered through pension_regimes with a single number. The fund invests the balances it owes in the household portfolio, which earns r_p, so it keeps the spread r_fdc_wedge times those balances as a pension reserve, capped at pension_reserve_max_GDPratio times GDP; reserves above the cap are paid to the government as pension reserve revenue. The reserve is never negative at the beginning of a period: any shortfall below zero (for example, with a negative wedge) is made up by a transfer from the government at the end of that period.",
"type": "float",
"number_dims": 1,
"value": [
Expand All @@ -4209,6 +4209,25 @@
}
}
},
"pension_reserve_max_GDPratio": {
"title": "Ceiling on the pension reserve of the funded defined contribution fund as a share of GDP.",
"description": "Maximum pension reserve, as a share of GDP, that the funded defined contribution (FDC) fund may hold beyond the balances it owes households. The reserve is invested in the household portfolio, earns r_p, and accumulates the spread r_fdc_wedge times the owed balances. Reserves above this ceiling are paid to the government as pension reserve revenue, which enters the government budget constraint but is not tax revenue. The reserve also has a floor of zero: at the end of any period in which it would fall below zero, the government transfers enough to the reserve that it begins the next period at zero or above.",
"section_1": "Fiscal Policy Parameters",
"section_2": "Government Pension Parameters",
"notes": "Only used when fdc_tau is positive. The reserve settles below the ceiling (and pays no revenue) only if r_p is below the growth rate (1 + g_n) e^{g_y} - 1 and the spread is small enough; otherwise it stays at the ceiling. Currently applied in the steady state only.",
"type": "float",
"value": [
{
"value": 0.5
}
],
"validators": {
"range": {
"min": 0.2,
"max": 0.8
}
}
},
"db_earn_cap_factor": {
"title": "Cap on the labor income that earns a defined benefit, as a multiple of initial-period average labor income.",
"description": "Labor income up to db_earn_cap_factor in period t times avg_labor_inc_t1_model_units (average labor income in the first model period) earns a defined benefit (computed with the Defined Benefits parameters). Under the Defined Benefits system with pension_earn_cap true, labor income above this cap earns no benefit. Under the hybrid defined benefit and notional defined contribution system, this is the upper cutoff of the defined benefit band and the lower cutoff of the notional defined contribution band, and labor income up to it is subject to the payroll tax tau_payroll.",
Expand Down
16 changes: 15 additions & 1 deletion ogcore/fiscal.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,13 @@ def get_G_ss(
new_borrowing,
debt_service,
p,
pension_reserve_revenue=0.0,
):
r"""
Calculate the steady-state values of government spending.

.. math::
\bar{G} = \bar{Rev} + \overline{FA}
\bar{G} = \bar{Rev} + \bar{\Psi} - \bar{\Phi} + \overline{FA}
+ \bar{D}\bigl[(1 + \bar{g}_n)e^{g_y} - (1 + \bar{r}_{gov})\bigr]
- \bar{I}_g - \bar{TR} - \overline{UBI}

Expand All @@ -290,6 +291,11 @@ def get_G_ss(
new_borrowing (scalar): steady-state amount of new borrowing
debt_service (scalar): steady-state debt service costs
p (OG-Core Specifications object): model parameters
pension_reserve_revenue (scalar): net payment from the funded
defined contribution fund's pension reserve to the
government, $\bar{\Psi} - \bar{\Phi}$: reserves above the
ceiling less the transfer that keeps the reserve from
falling below zero (not tax revenue)

Returns:
G (tuple): steady-state government spending
Expand All @@ -300,6 +306,7 @@ def get_G_ss(
else:
G = (
total_tax_revenue
+ pension_reserve_revenue
+ new_borrowing
+ foreign_aid
- (agg_pension_outlays + TR + debt_service + UBI_outlays + I_g)
Expand Down Expand Up @@ -337,6 +344,7 @@ def get_TR(
foreign_aid,
p,
method,
pension_reserve_revenue=0.0,
):
r"""
Function to compute aggregate transfers. Note that this excludes
Expand Down Expand Up @@ -364,6 +372,11 @@ def get_TR(
government
p (OG-Core Specifications object): model parameters
method (str): whether doing SS or TP calculation
pension_reserve_revenue (array_like): net payment from the
funded defined contribution fund's pension reserve to the
government: reserves above the ceiling less the transfer
that keeps the reserve from falling below zero (not tax
revenue)

Returns:
new_TR (array_like): new value of aggregate government transfers
Expand All @@ -372,6 +385,7 @@ def get_TR(
if p.budget_balance:
new_TR = (
total_tax_revenue
+ pension_reserve_revenue
+ foreign_aid
- agg_pension_outlays
- G
Expand Down
Loading