Pension Functions#
pensions.py modules
ogcore.pensions#
- ogcore.pensions.DB_1dim_loop(w, e, n, S_ret, S, g_y, L_inc_avg_s, L_inc_avg, DB, avg_earn_num_years, alpha_db, yr_contr)[source]#
Calculate public pension from a defined benefits system.
- Parameters:
w (array_like) – real wage rate
e (Numpy array) – effective labor units
n (Numpy array) – labor supply
S_ret (int) – retirement age
S (int) – number of periods in the model
g_y (array_like) – GDP growth rate
L_inc_avg_s (Numpy array) – average labor income
L_inc_avg (scalar) – average labor income
DB (Numpy array) – pension amount for each household
avg_earn_num_years (int) – number of years AIME is computed from
alpha_db (scalar) – replacement rate
yr_contr (scalar) – years of contribution
- Returns:
pension amount for each household
- Return type:
DB (Numpy array)
- ogcore.pensions.DB_2dim_loop(w, e, n, S_ret, S, g_y, L_inc_avg_sj, L_inc_avg, DB, avg_earn_num_years, alpha_db, yr_contr)[source]#
Calculate public pension from a defined benefits system.
- Parameters:
w (array_like) – real wage rate
e (Numpy array) – effective labor units
n (Numpy array) – labor supply
S_ret (int) – retirement age
S (int) – number of periods in the model
g_y (array_like) – GDP growth rate
L_inc_avg_sj (Numpy array) – average labor income
L_inc_avg (scalar) – average labor income
DB (Numpy array) – pension amount for each household
avg_earn_num_years (int) – number of years AIME is computed from
alpha_db (scalar) – replacement rate
yr_contr (scalar) – years of contribution
- Returns:
pension amount for each household
- Return type:
DB (Numpy array)
- ogcore.pensions.DB_3dim_loop(w_path, e_ss, n, n_preTP, S_ret, S, J, g_y, avg_earn_num_years, alpha_db, yr_contr)[source]#
Calculate public pension from a defined benefits system over the full time path.
Used when the TPI solution evaluates taxes for all periods at once to compute aggregates. Each retiree’s benefit is computed from their own cohort’s wage and labor history: the wage entering the average for a household aged u at time t, earned at age s, is the wage at time t - (u - s). Histories that predate the time path use the period-0 wage (trend growth is handled by the de-trending in the benefit formula) and the model’s initial labor supply, so this reproduces exactly what the per-cohort household solves compute and household behavior and aggregates are consistent. The inner work is vectorized rather than looped.
- Parameters:
w_path (Numpy array) – real wage rate path, length T
e_ss (Numpy array) – effective labor units, size SxJ
n (Numpy array) – labor supply, size TxSxJ
n_preTP (Numpy array) – pre-time-path labor supply, size SxJ
S_ret (int) – retirement age
S (int) – number of periods in the model
J (int) – number of lifetime income groups
g_y (scalar) – growth rate of technology
avg_earn_num_years (int) – number of years earnings are averaged over
alpha_db (scalar) – replacement rate per year of contribution
yr_contr (int) – years of contribution
- Returns:
pension amount for each household, size TxSxJ
- Return type:
DB (Numpy array)
- ogcore.pensions.DB_amount(w, e, n, j, p)[source]#
Calculate public pension from a defined benefits system.
\[pension{j,s,t} = \biggl[\frac{\sum_{s=R-ny}^{R-1}w_{t}e_{j,s,t} n_{j,s,t}}{ny}\biggr]\times Cy \times \alpha_{DB} \quad \forall s > R\]- Parameters:
w (array_like) – real wage rate
e (Numpy array) – effective labor units
n (Numpy array) – labor supply; may be a partial lifetime path (length < S, for cohorts alive when the time path begins), a steady-state vector (S,) or matrix (S, J), or the full time path (T, S, J)
j (int) – index of lifetime income group
p (OG-Core Specifications object) – model parameters
- Returns:
pension amount for each household
- Return type:
DB (Numpy array)
- ogcore.pensions.NDC_1dim_loop(w, e, n, S_ret, S, g_y, tau_p, g_ndc, delta_ret, NDC_s, NDC)[source]#
Calculate public pension from a notional defined contribution
- Parameters:
w (array_like) – real wage rate
e (Numpy array) – effective labor units
n (Numpy array) – labor supply
S_ret (int) – retirement age
S (int) – number of periods in the model
g_y (array_like) – GDP growth rate
tau_p (scalar) – tax rate
g_ndc (scalar) – growth rate of NDC pension
delta_ret (scalar) – conversion coefficient for the NDC pension amount
NDC_s (Numpy array) – average labor income
NDC (Numpy array) – pension amount for each household
- Returns:
pension amount for each household
- Return type:
NDC (Numpy array)
- ogcore.pensions.NDC_2dim_loop(w, e, n, S_ret, S, g_y, tau_p, g_ndc, delta_ret, NDC_sj, NDC)[source]#
Calculate public pension from a notional defined contribution
- Parameters:
w (array_like) – real wage rate
e (Numpy array) – effective labor units
n (Numpy array) – labor supply
S_ret (int) – retirement age
S (int) – number of periods in the model
g_y (array_like) – GDP growth rate
tau_p (scalar) – tax rate
g_ndc (scalar) – growth rate of NDC pension
delta_ret (scalar) – conversion coefficient for the NDC pension amount
NDC_sj (Numpy array) – average labor income
NDC (Numpy array) – pension amount for each household
- Returns:
pension amount for each household
- Return type:
NDC (Numpy array)
- ogcore.pensions.NDC_amount(w, e, n, r, Y, j, p)[source]#
Calculate public pension from a notional defined contribution system.
\[pension{j,s,t} = \biggl[\sum_{s=E}^{R-1}\tau^{p}_{t}w_{t} e_{j,s,t}n_{j,s,t}(1 + g_{NDC,t})^{R-s-1}\biggr] \delta_{R, t} \quad \forall s > R\]- Parameters:
w (array_like) – real wage rate
e (Numpy array) – effective labor units
n (Numpy array) – labor supply
r (array_like) – interest rate
Y (array_like) – GDP
j (int) – index of lifetime income group
p (OG-Core Specifications object) – model parameters
- Returns:
pension amount for each household
- Return type:
NDC (Numpy array)
- ogcore.pensions.PS_1dim_loop(w, e, n, S_ret, S, g_y, vpoint, factor, L_inc_avg_s, PS)[source]#
Calculate public pension from a points system.
- Parameters:
w (array_like) – real wage rate
e (Numpy array) – effective labor units
n (Numpy array) – labor supply
S_ret (int) – retirement age
S (int) – number of periods in the model
g_y (array_like) – GDP growth rate
vpoint (scalar) – value of points
factor (scalar) – scaling factor converting model units to local currency
L_inc_avg_s (Numpy array) – average labor income
PS (Numpy array) – pension amount for each household
- Returns:
pension amount for each household
- Return type:
PS (Numpy array)
- ogcore.pensions.PS_2dim_loop(w, e, n, S_ret, S, J, g_y, vpoint, factor, L_inc_avg_sj, PS)[source]#
Calculate public pension from a points system.
- Parameters:
w (array_like) – real wage rate
e (Numpy array) – effective labor units
n (Numpy array) – labor supply
S_ret (int) – retirement age
S (int) – number of periods in the model
J (int) – number of lifetime income groups
g_y (array_like) – GDP growth rate
vpoint (scalar) – value of points
factor (scalar) – scaling factor converting model units to local currency
L_inc_avg_sj (Numpy array) – average labor income
PS (Numpy array) – pension amount for each household
- Returns:
pension amount for each household
- Return type:
PS (Numpy array)
- ogcore.pensions.PS_amount(w, e, n, j, factor, p)[source]#
Calculate public pension from a points system.
\[pension{j,s,t} = \sum_{s=E}^{R-1}w_{t}e_{j,s,t}n_{j,s,t} \times v_{t} \quad \forall s > R\]- Parameters:
w (array_like) – real wage rate
e (Numpy array) – effective labor units
n (Numpy array) – labor supply
j (int) – index of lifetime income group
factor (scalar) – scaling factor converting model units to dollars
p (OG-Core Specifications object) – model parameters
- Returns:
pension amount for each household
- Return type:
PS (Numpy array)
- ogcore.pensions.SS_amount(w, n, theta, t, j, shift, method, e, p)[source]#
Calculate public pension benefit amounts for each household under a US-style social security system.
- Parameters:
w (array_like) – real wage rate
n (Numpy array) – labor supply
theta (Numpy array) – social security replacement rate value for lifetime income group j
t (int) – time period
j (int) – index of lifetime income group
shift (bool) – whether computing for periods 0–s or 1–(s+1), =True for 1–(s+1)
method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’
e (Numpy array) – effective labor units
p (OG-Core Specifications object) – model parameters
- Returns:
pension amount for each household
- Return type:
pension (Numpy array)
- ogcore.pensions.delta_point(r, Y, g_n, g_y, p)[source]#
Compute growth rate used for contributions to points system pension
- Parameters:
r (array_like) – interest rate
Y (array_like) – GDP
g_n (array_like) – population growth rate
g_y (array_like) – GDP growth rate
p (OG-Core Specifications object) – model parameters
- Returns:
- growth rate used for contributions to
points
- Return type:
delta_point (Numpy array)
- ogcore.pensions.delta_ret(r, Y, p)[source]#
Compute conversion coefficient for the NDC pension amount
\[\delta_{R} = (dir_{R} + ind_{R} - k)^{-1}\]- Parameters:
r (array_like) – interest rate
Y (array_like) – GDP
p (OG-Core Specifications object) – model parameters
- Returns:
- conversion coefficient for the NDC
pension amount
- Return type:
delta_ret (Numpy array)
- ogcore.pensions.delta_ret_loop(S, S_ret, surv_rates, g_dir_value, dir_delta_s)[source]#
Compute conversion coefficient for the NDC pension amount
- Parameters:
S (int) – number of periods in the model
S_ret (int) – retirement age
surv_rates (Numpy array) – survival rates
g_dir_value (scalar) – growth rate of NDC pension
dir_delta_s (Numpy array) – conversion coefficient for the NDC pension amount
- Returns:
- conversion coefficient for the NDC pension
amount
- Return type:
dir_delta (scalar)
- ogcore.pensions.deriv_DB(w, e, per_rmn, p)[source]#
Change in DB pension benefits for another unit of labor supply
\[\begin{split}\frac{\partial \theta_{j,u,t+u-s}}{\partial n_{j,s,t}} = \begin{cases} 0 , & \text{if}\ s < R - Cy \\ w_{t}e_{j,s}\alpha_{DB}\times \frac{Cy}{ny}, & \text{if}\ R - Cy <= s < R \\ 0, & \text{if}\ s \geq R \\ \end{cases}\end{split}\]- Parameters:
w (array_like) – real wage rate
e (Numpy array) – effective labor units
per_rmn (int) – number of periods remaining in the model
p (OG-Core Specifications object) – model parameters
- Returns:
- change in DB pension benefits for another unit of labor
supply
- Return type:
d_theta
- ogcore.pensions.deriv_DB_loop(w, e, S, S_ret, per_rmn, avg_earn_num_years, alpha_db, yr_contr)[source]#
Change in DB pension benefits for another unit of labor supply
- Parameters:
w (array_like) – real wage rate
e (Numpy array) – effective labor units
S (int) – number of periods in the model
S_ret (int) – retirement age
per_rmn (int) – number of periods remaining in the model
avg_earn_num_years (int) – number of years AIME is computed from
alpha_db (scalar) – replacement rate
yr_contr (scalar) – years of contribution
- Returns:
- change in DB pension benefits for
another unit of labor supply
- Return type:
d_theta (Numpy array)
- ogcore.pensions.deriv_NDC(r, w, e, Y, per_rmn, p)[source]#
Change in NDC pension benefits for another unit of labor supply
\[\begin{split}\frac{\partial \theta_{j,u,t+u-s}}{\partial n_{j,s,t}} = \begin{cases} \tau^{p}_{t}w_{t}e_{j,s}(1+g_{NDC,t})^{u - s}\delta_{R,t}, & \text{if}\ s<R-1 \\ 0, & \text{if}\ s \geq R \\ \end{cases}\end{split}\]- Parameters:
r (array_like) – interest rate
w (array_like) – real wage rate
e (Numpy array) – effective labor units
Y (array_like) – GDP
per_rmn (int) – number of periods remaining in the model
p (OG-Core Specifications object) – model parameters
- Returns:
- change in NDC pension benefits for
another unit of labor supply
- Return type:
d_theta (Numpy array)
- ogcore.pensions.deriv_NDC_loop(w, e, per_rmn, S, S_ret, tau_p, g_ndc_value, delta_ret_value, d_theta)[source]#
Change in NDC pension benefits for another unit of labor supply
- Parameters:
w (array_like) – real wage rate
e (Numpy array) – effective labor units
per_rmn (int) – number of periods remaining in the model
S (int) – number of periods in the model
S_ret (int) – retirement age
tau_p (scalar) – tax rate
g_ndc_value (scalar) – growth rate of NDC pension
delta_ret_value (scalar) – conversion coefficient for the NDC pension amount
d_theta (Numpy array) – change in NDC pension benefits for another unit of labor supply
- Returns:
- change in NDC pension benefits for
another unit of labor supply
- Return type:
d_theta (Numpy array)
- ogcore.pensions.deriv_PS(w, e, per_rmn, factor, p)[source]#
Change in points system pension benefits for another unit of labor supply
\[\begin{split}\frac{\partial \theta_{j,u,t+u-s}}{\partial n_{j,s,t}} = \begin{cases} 0 , & \text{if}\ s < R \\ w_{t}e_{j,s}v_{t}, & \text{if}\ s \geq R \\ \end{cases}\end{split}\]- Parameters:
w (array_like) – real wage rate
e (Numpy array) – effective labor units
per_rmn (int) – number of periods remaining in the model
factor (scalar) – scaling factor converting model units to
p (OG-Core Specifications object) – model parameters
- Returns:
- change in points system pension benefits
for another unit of labor supply
- Return type:
d_theta (Numpy array)
- ogcore.pensions.deriv_PS_loop(w, e, S, S_ret, per_rmn, d_theta, vpoint, factor)[source]#
Change in points system pension benefits for another unit of labor supply
- Parameters:
w (array_like) – real wage rate
e (Numpy array) – effective labor units
S (int) – number of periods in the model
S_ret (int) – retirement age
per_rmn (int) – number of periods remaining in the model
d_theta (Numpy array) – change in points system pension benefits for another unit of labor supply
vpoint (scalar) – value of points
factor (scalar) – scaling factor converting model units to local currency
- Returns:
- change in points system pension benefits
for another unit of labor supply
- Return type:
d_theta (Numpy array)
- ogcore.pensions.deriv_theta(r, w, e, Y, per_rmn, factor, p)[source]#
Change in pension benefits for another unit of labor supply for pension system selected
- Parameters:
r (array_like) – interest rate
w (array_like) – real wage rate
e (Numpy array) – effective labor units
Y (array_like) – GDP
per_rmn (int) – number of periods remaining in the model
factor (scalar) – scaling factor converting model units to
- Returns:
- change in pension benefits for another
unit of labor supply
- Return type:
d_theta (Numpy array)
- ogcore.pensions.g_dir(r, Y, g_y, g_n, dir_growth_rate)[source]#
Compute growth rate used for contributions to NDC pension
- Parameters:
r (array_like) – interest rate
Y (array_like) – GDP
g_y (array_like) – GDP growth rate
g_n (array_like) – population growth rate
dir_growth_rate (str) – growth rate used for contributions to NDC
- Returns:
growth rate used for contributions to NDC
- Return type:
g_dir (Numpy array)
- ogcore.pensions.g_ndc(r, Y, p)[source]#
Compute growth rate used for contributions to NDC pension
- Parameters:
r (array_like) – interest rate
Y (array_like) – GDP
p (OG-Core Specifications object) – model parameters
- Returns:
growth rate used for contributions to NDC
- Return type:
g_ndc (Numpy array)
- ogcore.pensions.pension_amount(r, w, n, Y, theta, t, j, shift, method, e, factor, p)[source]#
Calculate public pension benefit amounts for each household.
- Parameters:
w (array_like) – real wage rate
n (Numpy array) – labor supply
theta (Numpy array) – social security replacement rate value for lifetime income group j
t (int) – time period
j (int) – index of lifetime income group
shift (bool) – whether computing for periods 0–s or 1–(s+1), =True for 1–(s+1)
method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’
e (Numpy array) – effective labor units
p (OG-Core Specifications object) – model parameters
- Returns:
pension amount for each household
- Return type:
pension (Numpy array)
- ogcore.pensions.replacement_rate_vals(nssmat, wss, factor_ss, j, p)[source]#
Calculates replacement rate values for the social security system.
\[\theta_{j,R,t+R} = \frac{PIA_{j,R,t+R} \times 12}{factor \times w_{t+R}}\]- Parameters:
nssmat (Numpy array) – initial guess at labor supply, size = SxJ
new_w (scalar) – steady state real wage rate
factor_ss (scalar) – scaling factor converting model units to dollars
j (int) – index of lifetime income group
p (OG-Core Specifications object) – model parameters
- Returns:
- social security replacement rate value for
lifetime income group j
- Return type:
theta (Numpy array)