Skip to content

Commit

Permalink
Merge pull request #1905 from martinholmer/check-pension-income
Browse files Browse the repository at this point in the history
Add check of total>=taxable pension income
  • Loading branch information
martinholmer authored Mar 8, 2018
2 parents 5b20973 + e452fe6 commit f55d018
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
9 changes: 6 additions & 3 deletions docs/index.htmx
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,12 @@ above equations hold for each filing unit in the input file.</p>
<p>In addition to this earnings-splitting data-preparation issue,
Tax-Calculator expects that the value of ordinary dividends
(<kbd>e00600</kbd>) will be no less than the value of qualified
dividends (<kbd>e00650</kbd>) for each filing unit. Again, it is your
responsibility to prepare input data in a way that ensures this
relationship is true for each filing unit.</p>
dividends (<kbd>e00650</kbd>) for each filing unit. And it also
expects that the value of total pension and annuity income
(<kbd>e01500</kbd>) will be no less than the value of taxable pension
and annuity income (<kbd>e01700</kbd>) for each filing unit. Again,
it is your responsibility to prepare input data in a way that ensures
these relationships are true for each filing unit.</p>

<p id="marskids">Here's an example of how to specify a few stylized
filing units with and without young children.
Expand Down
6 changes: 6 additions & 0 deletions taxcalc/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ def __init__(self,
rtol=0.0, atol=tol):
msg = 'expression "e00600 >= e00650" is not true for every record'
raise ValueError(msg)
# check that total pension income is no less than taxable pension inc
nontaxable_pensions = np.maximum(0., self.e01500 - self.e01700)
if not np.allclose(self.e01500, self.e01700 + nontaxable_pensions,
rtol=0.0, atol=tol):
msg = 'expression "e01500 >= e01700" is not true for every record'
raise ValueError(msg)
# handle grow factors
is_correct_type = isinstance(gfactors, Growfactors)
if gfactors is not None and not is_correct_type:
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/records_variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
},
"e01500": {
"type": "float",
"desc": "Pensions and annuities",
"desc": "Total pensions and annuities",
"form": {"2013-2016": "1040 line 16a"},
"availability": "taxdata_puf, taxdata_cps"
},
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/tests/puf_var_wght_means_by_year.csv
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ e00900,Sch C business net profit/loss for filing unit, 1862, 1957, 2035
e01100,Capital gain distributions not reported on Sch D, 14, 20, 25, 23, 25, 26, 26, 26, 27, 28, 28, 29, 30, 31, 32
e01200,Other net gain/loss from Form 4797, -133, -184, -236, -205, -225, -229, -225, -231, -235, -239, -247, -254, -261, -269, -278
e01400,Taxable IRA distributions, 1556, 1671, 1767, 1840, 1929, 2033, 2137, 2246, 2357, 2475, 2596, 2719, 2852, 2987, 3126
e01500,Pensions and annuities, 6170, 6420, 6687, 6843, 7039, 7275, 7516, 7762, 8028, 8305, 8591, 8877, 9173, 9490, 9811
e01500,Total pensions and annuities, 6170, 6420, 6687, 6843, 7039, 7275, 7516, 7762, 8028, 8305, 8591, 8877, 9173, 9490, 9811
e01700,Taxable pensions and annuities, 3936, 4092, 4246, 4327, 4430, 4557, 4688, 4823, 4971, 5124, 5279, 5440, 5601, 5774, 5953
e02000,"Sch E total rental, royalty, partnership, S-corporation, etc, income/loss (includes e26270 and e27200)", 3781, 4192, 4165, 4093, 4036, 3978, 3957, 3962, 3993, 4052, 4148, 4254, 4363, 4486, 4612
e02100,Farm net income/loss for filing unit from Sch F, -48, -43, -21, -15, -12, -18, -22, -27, -32, -35, -38, -39, -40, -40, -39
Expand Down
4 changes: 4 additions & 0 deletions taxcalc/tests/test_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ def test_correct_Records_instantiation(cps_subsample):
(
u'RECID,MARS,e00600,e00650\n'
u'1, 1, 8, 9\n'
),
(
u'RECID,MARS,e01500,e01700\n'
u'1, 1, 6, 7\n'
)
])
def test_read_data(csv):
Expand Down

0 comments on commit f55d018

Please sign in to comment.