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

Fraction of AGI cap on the dollar amount of gross itemized deductions. #1542

Merged
merged 17 commits into from
Sep 7, 2017

Conversation

MattHJensen
Copy link
Contributor

Resolves #1526.

@MattHJensen MattHJensen changed the title [WIP] Itemdedcap [WIP] Fraction of AGI cap on the dollar amount of gross itemized deductions. Sep 6, 2017
@MattHJensen
Copy link
Contributor Author

MattHJensen commented Sep 6, 2017

I applied the new feature in #1542 to the reform requested by a TaxBrain user in #1525: "Limit state and local deduction (including real estate) to 2% of agi."

In 2018
CBO: $86.6B
Tax-Calculator: $92.2B

Import taxcalc package and other useful packages

import sys
sys.path.append("../../")
from taxcalc import *

Create Plan X and Plan Y Policy objects containing current law policy and then implement reforms

# The baseline includes AMT repeal. 
p_xx = Policy()

# The reform expands the second tax bracket
# (and repeals AMT to match the baseline)

p_yy = Policy()
reform_yy = {
    2017: {
        '_ID_AmountCap_rt': [0.02],
        '_ID_AmountCap_Switch': [[False, True, True, False, False, False, False, False]]
    }
}
p_yy.implement_reform(reform_yy)

Create calculator objects with default tax data

The data are automatically extrapolated to 2013 since that is the first tax year modeled by Tax-Calculator.
c_xx = Calculator(policy=p_xx, records=Records("../../puf.csv"))
c_yy = Calculator(policy=p_yy, records=Records("../../puf.csv"))
You loaded data for 2009.
Tax-Calculator startup automatically extrapolated your data to 2013.
You loaded data for 2009.
Tax-Calculator startup automatically extrapolated your data to 2013.

Advance the calculator objects to 2018 for this analysis.

c_xx.advance_to_year(2018)
c_yy.advance_to_year(2018)

Calculate taxes under the baseline and under the reform.

c_xx.calc_all()
c_yy.calc_all()

Calculate the change in combined payroll and individual income tax revenue between the baseline and reform

((c_yy.records.combined - c_xx.records.combined)*c_xx.records.s006).sum()
92241173475.438873

@codecov-io
Copy link

codecov-io commented Sep 6, 2017

Codecov Report

Merging #1542 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #1542   +/-   ##
======================================
  Coverage     100%    100%           
======================================
  Files          37      37           
  Lines        2565    2560    -5     
======================================
- Hits         2565    2560    -5
Impacted Files Coverage Δ
taxcalc/calculate.py 100% <100%> (ø) ⬆️
taxcalc/utils.py 100% <0%> (ø) ⬆️
taxcalc/taxcalcio.py 100% <0%> (ø) ⬆️

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 53c129a...f18daee. Read the comment docs.

@MattHJensen MattHJensen changed the title [WIP] Fraction of AGI cap on the dollar amount of gross itemized deductions. Fraction of AGI cap on the dollar amount of gross itemized deductions. Sep 6, 2017
@MattHJensen
Copy link
Contributor Author

PR #1542 is ready for review.

@martinholmer
Copy link
Collaborator

@MattHJensen, Pull request #1542 failed several style tests:

PYLINT functions.py
************* Module taxcalc.functions
functions.py:342: [R0912(too-many-branches), ItemDedCap] Too many branches (17/12)
...
PYLINT policy.py
************* Module taxcalc.policy
policy.py:222: [W0109(duplicate-key), Policy] Duplicate key 'medical' in dictionary
policy.py:222: [W0109(duplicate-key), Policy] Duplicate key 'statelocal' in dictionary
policy.py:222: [W0109(duplicate-key), Policy] Duplicate key 'realestate' in dictionary
policy.py:222: [W0109(duplicate-key), Policy] Duplicate key 'casualty' in dictionary
policy.py:222: [W0109(duplicate-key), Policy] Duplicate key 'misc' in dictionary
policy.py:222: [W0109(duplicate-key), Policy] Duplicate key 'interest' in dictionary
...
PEP8 current_law_policy.json
current_law_policy.json:1611:8: E131 continuation line unaligned for hanging indent
...
PEP8 records_variables.json
records_variables.json:805:20: E231 missing whitespace after ':'
records_variables.json:810:20: E231 missing whitespace after ':'

The problems in the policy.py file seem serious.

@martinholmer
Copy link
Collaborator

@MattHJensen, If you really want to treat cash and noncash charitable contributions differently, then why not also do that for the existing limit on the tax benefit of itemized deductions capability? That way you don't have to maintain two sets of indexes, and therefore, you can avoid the pylint errors for multiple dictionary keys in policy.py. Why would the boolean switches for which kind of itemized deductions to limit differ between the case where we limit the tax benefit and the case where we limit the gross amount?

Does this make sense?

@martinholmer
Copy link
Collaborator

@MattHJensen said:

I applied the new feature in #1542 to the reform requested by a TaxBrain user in #1525: "Limit state and local deduction (including real estate) to 2% of agi."

In 2018
CBO: $86.6B
Tax-Calculator: $92.2B

Good to check against CBO results.
You should consider adding this reform to test_reforms.py as comparison test 55.

@MattHJensen
Copy link
Contributor Author

@martinholmer, the latest three commits address your suggestions. Thank you very much for proposing them.

@martinholmer
Copy link
Collaborator

Pull request #1542 looks great! Thanks for the contribution, @MattHJensen.
The reform test you added seemed OK even though we using a PUF subsample.

I'm going to merge this now.

But I have one very minor question about comparison test 55:

Comparison test 55
 +    """
 +    reform_json = """
 +    {
 +        "start_year": 2017,
 +        "value": {"_ID_AmountCap_rt": [0.02],
 +                  "_ID_AmountCap_Switch":
 +                  [[false, true, true, false, false, false, false]]},
 +        "name": "Limit amount of S&L deduction to 2% AGI",
 +        "output_type": "iitax",
 +        "compare_with": {"Budget Options": [44.1, 86.6, 87.1, 91.2]}
 +    }
 +    """
 +    expected_res = ('Limit amount of S&L deduction to 2% AGI'
 +                    '\n'
 +                    'Tax-Calculator,86.2,90.3,94.6,98.9')

Is the first of the four Budget Options estimates really 44.1?
If that's a typo, let me know and I'll fix in my my pending pull request.

@martinholmer martinholmer merged commit 28fbaf3 into PSLmodels:master Sep 7, 2017
@MattHJensen
Copy link
Contributor Author

@martinholmer asked:

Is the first of the four Budget Options estimates really 44.1?

It is not a typo. That's typical of the budget options - the first year is often about half of the second year. I am not sure why they do that, but I would like to know.

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.

4 participants