-
-
Notifications
You must be signed in to change notification settings - Fork 150
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
Added Test to Check Reform Consistency for Itemized Deduction Surtax and Itemized Deduction Haircut #749
Conversation
Sean, Do you see the error message that describes why the py.test suite failed? |
For those following the new pull request #749, this is follow-on work from the late-2015 pull request #490, which found that two different ways of completely eliminating itemized deductions do not produce exactly the same results. Both pull requests include a new test
By adding the following statements to the test
we see that, out of the 219,814 filing units in the But the changes in the code so far (pull request #749 is still a work-in-progress) have the undesirable effect of creating massive failures in the validations tests. So, for example, using the d15 validation sample of 100,000 unit, we have gone from having no income tax liability differences of more than one cent to having 91,801 differences of more than one cent between Tax-Calculator (under pull request #749) and Internet TAXSIM, when both models are simulating current-law policy. And the code changes so far also have the effect of creating large increases in aggregate income tax revenues under current-law policy: a rise of about 7.7 percent in 2013 and a rise of about 8.3 percent in 2022. Do we think Tax-Calculator is that far off in simulating income tax revenue under current law? I don't understand why these changes in the validation test results and the requires_pufcsv unit tests are not being included in the commits in this pull request. The incomplete commits give a misleading impression of the implications of the proposed code changes. |
@martinholmer: |
@martinholmer: |
Sean (@GoFroggyRun), I have been able to confirm that income tax liability is exact the same for each of the I have just two small requests. (1) Can you add to this conversation a description about which change actually fixed the bug? A number of the code changes in this pull request seem to be debugging aids, not changes in tax-calculation logic. What change (or changes) were essential in eliminating the bug? (2) Can you remove from the If you can do both of these things this afternoon, I'll be happy the merge this pull request before I go out-of-town for a week. |
Current coverage is 95.07%
@@ master #749 diff @@
==========================================
Files 12 12
Lines 1720 1746 +26
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 1500 1660 +160
+ Misses 220 86 -134
Partials 0 0
|
Sure. I have removed Regarding your other request:
My finding is that these |
Sean said:
What a minute. Now that you point out this Maybe I don't understand the nature of these two types of reforms, but what happens when a user specifies a reform with ID_BenefitSurtax_crt equal to 0.02 and each of the seven ID_*_HC parameters equal to 0.10? The code above will overwrite four of the seven HC parameters. Is that right? I think you need another test, using just one filing unit, to check that the code in this pull request produces the correct (as calculated by hand) answer with these values of the reform parameters. |
Yes, you are absolutely right. If I don't think I'll be able to get this done by the end of today, so please enjoy your vacation. And I'll figure this out as soon as I can. |
Sean said:
I would never expect you to be able to investigate this issue that fast. This is a complex problem that will probably take days to solve. Don't rush this. Let's get the logic correct in this pull request. Just remember that Matt's original test was just a corner (or extreme) situation in which itemized deductions were completely eliminated in two different ways: (1) by full itemized-deduction haircuts, and (2) by turning the itemized deductions into credits but limiting the credit to be no more than zero percent of AGI. But most real-world reforms of this type will be either partial haircuts or limited credits (in lieu of deductions), or some combination of the two (as in my example). I'll be back in my offices on Tuesday, May 24th. |
On Fri, 13 May 2016, Martin Holmer wrote:
Neither of these would affect the deductions shown as preferences on the dan
|
As described in #752, the problem unit in After a conversation with @MattHJensen, we think that, although there're some rare cases that the test added might not pass, it should still hold for almost all units in general, and thus we might want to give an exclusion to such special, and counter intuitive, case in #752. What I have in mind is that, given we've already know the fundamental reason that give rise to #752, we could add an exclusion in the test suite, according to the findings in #752, so that all other units can still be tested for SurtaxBenifit. Does this sound a reasonable approach? Comments, concerns or remarks would be appreciated. |
Sean @GoFroggyRun,
So, in the fourth year, the proposed change in logic causes Tax-Calculator to switch from an estimate of $24.4 billion to $2.8 billion. That is a reduction of about 88 percent. That is a very large reduction. Can you provide a clear English explanation for this enormous reduction? Also, I wonder why the Budget Options estimate is declining over time while the Tax-Calculator estimates are rising over time. Can you provide an explanation of that difference? |
Thanks for your comment regarding the taxcalc/comparison/reform_results.txt file. The change in the reform_results.txt file was resulted from one of my previous code line change, which has now been reverted. So right now the file has been updated, and there's only rather slight increment to that particular item A big change I have made to this added test suite is that, given we have known the reason that give rise to the "bug" in #752, I then excluded units who would get better-off when choose to have no deduction, and thus made this test applicable to other "normal" units. And after this change being applied, this test will pass when fed by the full All tests passed, expect one slight change in reform_results.txt file, item @martinholmer Please take a look. |
Can you clarify in the comment just before the following lines what is going on here?
|
@martinholmer: |
Sean, I don't see any absolute-value calculations in your code below:
So, I don't understand the phrase "in terms of absolute value". Can you clarify? Also, how many records (number and percent) are excluded by the last statement above? |
@martinholmer Sure. So, as described in #752, the only case where some unit would get better-off when choose to have zero deduction amount is that his/her AMT liability gap overwhelms his/her regular tax liability gap. More specifically, in the two calculators defined in the test suite,
and thus And regarding your second concern, the only unit being excluded is record with |
Sean @GoFroggyRun, Thanks for the more complete explanation of the exclusion of records in the new test. @MattHJensen and Dan @feenberg, do either of you have any concerns about these changes in pull request #749? If not, should I merge this pull request into the master branch? |
Sean (@GoFroggyRun) said in the discussion of pull request #722:
So, if #749 just adds a test, why does it include so many changes to the tax-calculation logic? From what you are saying it seems like you need to eliminate many of the code changes in pull request #749. |
Apart from adding a test suite, this PR also rearranges our standard deduction vs Itemized deduction optimization into a separate function called Although the above changes don't have any impact toward tax-logic, they might explain why you are seeing massive code-line changes. |
@GoFroggyRun, could you explain why you think In the future it may be helpful to break these kinds of changes into separate PRs. If the core part of this PR, the test, were in a separate PR then it wouldn't be held up by secondary discussions about topics such as the placement of |
Sure. At the beginning, it seems to me that the
Sure. Got you! |
@GoFroggyRun said:
Sounds good. Could you leave a comment here after you push the new commit? |
@MattHJensen: |
This PR continues to resolve a bug which was found in #490 by @MattHJensen. And the issue has been mostly identified in #748, which is that the
BenefitSurtax
function doesn't seem to be working properly. Specifically, the itemized deduction switch won't be turning on for the AMTI function, when the reform is implemented using_ID_BenefitSurtax_crt
parameter, orBenefitSurtax
function.In particular, this PR does three things:
BenefitSurtax
function fromfunctions.py
tocalculate.py
, where I think the latter one seems to be a more appropriate place to put this function.test_calculate.py
that examines the consistency of implementing the same reform in two different ways: one specifies all sevenID_xxxx_HC
items (to 1); while the other uses_ID_BenefitSurtax_crt
parameter (set to 0) andBenefitSurtax
function. The test has passed using the full09puf
on my local machine, and was then switched to using91puf
as input for the purpose of Travis CI testing.AMTI
function, when the reform is being implemented usingBenefitSurtax
function. Another switch has been added to theAMTI
function to make sure everything is working properly. I'd appreciate any ''smarter" ideas to fix this though.The TAXSIM validation continues to pass, and the changes do not affect any
puf
result or anymtr
result at all. There's one slight change inreform_results.txt
, which I believe is moving toward the right direction, given that theBenefitSurtax
function is not properly working beforehand.Any comments, concerns or remarks would be appreciated. Especially on how to fix this bug in a "smarter" way.
@martinholmer @MattHJensen @Amy-Xu