Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Round inflated parameter values to nearest cent #1506

Merged
merged 8 commits into from
Aug 11, 2017
Merged

Round inflated parameter values to nearest cent #1506

merged 8 commits into from
Aug 11, 2017

Conversation

martinholmer
Copy link
Collaborator

This pull request rounds each wage-inflated and price-inflated policy parameter value to the nearest cent. This rounding is done each time a parameter's value for a year is inflated from that parameter's value in the prior year. This change causes a few rounding errors in a couple of years for some intermediate tax results. There are no changes in any tax liability amounts (which have always been rounded to the nearest one-tenth of a billion dollars) and no changes in the marginal tax rate histogram counts.

This change is being made to simplify TaxBrain programming in the spirit of the approach advocated by @talumbau in TaxBrain issue 596.

@MattHJensen @feenberg @Amy-Xu @andersonfrailey @hdoupe @GoFroggyRun @codykallen
@brittainhard @PeterDSteinberg

@codecov-io
Copy link

codecov-io commented Aug 10, 2017

Codecov Report

Merging #1506 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1506      +/-   ##
==========================================
+ Coverage   99.96%   99.96%   +<.01%     
==========================================
  Files          37       37              
  Lines        2553     2557       +4     
==========================================
+ Hits         2552     2556       +4     
  Misses          1        1
Impacted Files Coverage Δ
taxcalc/parameters.py 99.58% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 13f03f2...21b27f2. Read the comment docs.

@martinholmer
Copy link
Collaborator Author

martinholmer commented Aug 10, 2017

I had to add a temporary @xfail decorator to test_agg in the test_cpscsv.py file in order to get around the fact that for some reason the test passes under Python 2.7, but fails on Python 3.5 and 3.6. I'm going to improve the test_agg actual-vs-expected difference reporting in another commit in this pull request and hopefully the better error reporting will reveal the source of the Python 3.x test failures.

@martinholmer
Copy link
Collaborator Author

martinholmer commented Aug 10, 2017

The improved difference reporting in test_cpscsv.py (commit ecd9d80) shows that Python 3.x ten-year diagnostic table results differ for two intermediate variables for just one year each. Itemized Deductions differ by 0.1 in 2023 (1953.2 vs 1953.3) and Taxable Income differs by 0.1 in 2020 (8144.9 vs 8150.0). While surprising (does Python 3.x have different float-point libraries than Python 2.7, or what?), these differences are clearly rounding error. Next step is to conduct the diagnostic table results comparison in a way that allows rounding error, in a way that is analogous to comparing dollar arrays using numpy.allclose(x1, x2, atol=0.01, rtol=0.0), which allows the array elements to differ by as much as one cent.

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