@@ -73,26 +73,24 @@ def test_replacement_rate_vals(n, w, factor, j, p_in, expected):
73
73
74
74
75
75
p = Specifications ()
76
- # p.update_specifications({
77
- # "S": 7,
78
- # "rep_rate_py": 0.2
79
- # })
80
76
p .S = 7
81
- p .rep_rate_py = 0.2
77
+ p .alpha_db = 0.2
82
78
p .retire = 4
83
- p .last_career_yrs = 3
79
+ p .avg_earn_num_years = 50
84
80
p .yr_contr = 4
85
81
p .g_y = np .ones (p .T ) * 0.03
86
82
j = 1
87
83
w = np .array ([1.2 , 1.1 , 1.21 , 1.0 , 1.01 , 0.99 , 0.8 ])
88
84
e = np .array ([1.1 , 1.11 , 0.9 , 0.87 , 0.87 , 0.7 , 0.6 ])
89
85
n = np .array ([0.4 , 0.45 , 0.4 , 0.42 , 0.3 , 0.2 , 0.2 ])
86
+ equiv_periods = int (round ((p .S / 80.0 ) * p .avg_earn_num_years )) - 1
90
87
L_inc_avg = np .zeros (0 )
91
- L_inc_avg_s = np .zeros (p . last_career_yrs )
88
+ L_inc_avg_s = np .zeros (equiv_periods )
92
89
DB = np .zeros (p .S )
93
90
DB_loop_expected1 = np .array (
94
91
[0 , 0 , 0 , 0 , 0.337864778 , 0.327879365 , 0.318189065 ]
95
92
)
93
+
96
94
args1 = (
97
95
w ,
98
96
e ,
@@ -103,8 +101,8 @@ def test_replacement_rate_vals(n, w, factor, j, p_in, expected):
103
101
L_inc_avg_s ,
104
102
L_inc_avg ,
105
103
DB ,
106
- p . last_career_yrs ,
107
- p .rep_rate_py ,
104
+ equiv_periods ,
105
+ p .alpha_db ,
108
106
p .yr_contr ,
109
107
)
110
108
@@ -154,24 +152,25 @@ def test_DB_1dim_loop(args, DB_loop_expected):
154
152
p .S = 7
155
153
p .retire = 4
156
154
per_rmn = p .S
157
- p .last_career_yrs = 3
155
+ p .avg_earn_num_years = 50
158
156
p .yr_contr = p .retire
159
- p .rep_rate_py = 0.2
157
+ p .alpha_db = 0.2
160
158
p .g_y = np .ones (p .T ) * 0.03
161
159
w = np .array ([1.2 , 1.1 , 1.21 , 1 , 1.01 , 0.99 , 0.8 ])
162
160
e = np .array ([1.1 , 1.11 , 0.9 , 0.87 , 0.87 , 0.7 , 0.6 ])
163
161
deriv_DB_loop_expected = np .array (
164
162
[0.352 , 0.3256 , 0.2904 , 0.232 , 0.0 , 0.0 , 0.0 ]
165
163
)
166
164
d_theta_empty = np .zeros_like (w )
165
+ equiv_periods = int (round ((p .S / 80.0 ) * p .avg_earn_num_years )) - 1
167
166
args3 = (
168
167
w ,
169
168
e ,
170
169
p .S ,
171
170
p .retire ,
172
171
per_rmn ,
173
- p . last_career_yrs ,
174
- p .rep_rate_py ,
172
+ equiv_periods ,
173
+ p .alpha_db ,
175
174
p .yr_contr ,
176
175
)
177
176
@@ -228,9 +227,9 @@ def test_deriv_PS_loop(args, deriv_PS_loop_expected):
228
227
p = Specifications ()
229
228
p .S = 7
230
229
p .retire = 4
231
- p .last_career_yrs = 3
230
+ p .avg_earn_num_years = 50
232
231
p .yr_contr = p .retire
233
- p .rep_rate_py = 0.2
232
+ p .alpha_db = 0.2
234
233
p .g_y = np .ones (p .T ) * 0.03
235
234
n_ddb1 = np .array ([0.4 , 0.45 , 0.4 , 0.42 , 0.3 , 0.2 , 0.2 ])
236
235
w_ddb1 = np .array ([1.2 , 1.1 , 1.21 , 1 , 1.01 , 0.99 , 0.8 ])
@@ -246,7 +245,7 @@ def test_deriv_PS_loop(args, deriv_PS_loop_expected):
246
245
p2 .retire = 5
247
246
p2 .last_career_yrs = 2
248
247
p2 .yr_contr = p2 .retire
249
- p2 .rep_rate_py = 0.2
248
+ p2 .alpha_db = 0.2
250
249
p2 .g_y = 0.03
251
250
n_ddb2 = np .array ([0.45 , 0.4 , 0.42 , 0.3 , 0.2 , 0.2 ])
252
251
w_ddb1 = np .array ([1.1 , 1.21 , 1 , 1.01 , 0.99 , 0.8 ])
@@ -387,9 +386,9 @@ def test_deriv_NDC(args, d_NDC_expected):
387
386
p .pension_system = "Defined Benefits"
388
387
p .S = 7
389
388
p .retire = 4
390
- p .last_career_yrs = 3
389
+ p .avg_earn_num_years = 50
391
390
p .yr_contr = p .retire
392
- p .rep_rate_py = 0.2
391
+ p .alpha_db = 0.2
393
392
p .g_y = np .ones (p .T ) * 0.03
394
393
w_db = np .array ([1.2 , 1.1 , 1.21 , 1.0 , 1.01 , 0.99 , 0.8 ])
395
394
e_db = np .array ([1.1 , 1.11 , 0.9 , 0.87 , 0.87 , 0.7 , 0.6 ])
@@ -449,14 +448,16 @@ def test_deriv_NDC(args, d_NDC_expected):
449
448
p4 = Specifications ()
450
449
p4 .pension_system = "US-Style Social Security"
451
450
p4 .S = 7
452
- p4 .retire = 4
451
+ p4 .retire = ( np . ones ( p4 . T ) * 4 ). astype ( int )
453
452
w_ss = np .array ([1.2 , 1.1 , 1.21 , 1.0 , 1.01 , 0.99 , 0.8 ])
454
453
e_ss = np .array ([1.1 , 1.11 , 0.9 , 0.87 , 0.87 , 0.7 , 0.6 ])
455
454
n_ss = np .array ([0.4 , 0.45 , 0.4 , 0.42 , 0.3 , 0.2 , 0.2 ])
456
455
omegas = (1 / p4 .S ) * np .ones (p4 .S )
457
- theta = 0.4
458
- p .replacement_rate_adjust = np .ones (p4 .T )
459
- pension_expected_ss = [0 , 0 , 0 , 0 , 0.004164689 , 0.004041603 , 0.003922156 ]
456
+ theta = np .array ([0.4 , 0.4 ])
457
+ p4 .replacement_rate_adjust = np .ones (p4 .T )
458
+ pension_expected_ss = [0 , 0 , 0 , 0 , 0.404 , 0.396 , 0.32 ]
459
+ method = "TPI"
460
+ shift = False
460
461
args_ss = (r , w_ss , n_ss , Y , theta , t , j , shift , method , e_ss , factor , p4 )
461
462
462
463
@@ -592,9 +593,9 @@ def test_delta_ret_loop(args, dir_delta_ret_expected):
592
593
p = Specifications ()
593
594
p .S = 7
594
595
p .retire = 4
595
- p .last_career_yrs = 3
596
+ p .avg_earn_num_years = 50
596
597
p .yr_contr = p .retire
597
- p .rep_rate_py = 0.2
598
+ p .alpha_db = 0.2
598
599
p .g_y = np .ones (p .T ) * 0.03
599
600
j = 1
600
601
w = np .array ([1.2 , 1.1 , 1.21 , 1.0 , 1.01 , 0.99 , 0.8 ])
@@ -607,9 +608,9 @@ def test_delta_ret_loop(args, dir_delta_ret_expected):
607
608
p2 = Specifications ()
608
609
p2 .S = 7
609
610
p2 .retire = 4
610
- p2 . last_career_yrs = 3
611
+ p . avg_earn_num_years = 50
611
612
p2 .yr_contr = p2 .retire
612
- p2 .rep_rate_py = 0.2
613
+ p2 .alpha_db = 0.2
613
614
p2 .g_y = np .ones (p2 .T ) * 0.03
614
615
j = 1
615
616
w2 = np .array ([1.21 , 1.0 , 1.01 , 0.99 , 0.8 ])
@@ -663,9 +664,9 @@ def test_DB(args, DB_expected):
663
664
p .S = 7
664
665
p .retire = 4
665
666
per_rmn = p .S
666
- p .last_career_yrs = 3
667
+ p .avg_earn_num_years = 50
667
668
p .yr_contr = p .retire
668
- p .rep_rate_py = 0.2
669
+ p .alpha_db = 0.2
669
670
w_ddb = np .array ([1.2 , 1.1 , 1.21 , 1 , 1.01 , 0.99 , 0.8 ])
670
671
e_ddb = np .array ([1.1 , 1.11 , 0.9 , 0.87 , 0.87 , 0.7 , 0.6 ])
671
672
p .g_y = np .ones (p .T ) * 0.03
0 commit comments