Skip to content

Commit

Permalink
Merge pull request #196 from jdebacker/corp_incidence
Browse files Browse the repository at this point in the history
Distributing the corporate income tax across individual taxpayers
  • Loading branch information
jdebacker authored Apr 23, 2024
2 parents 10c94ef + fa0d3bb commit 1a7e67f
Show file tree
Hide file tree
Showing 28 changed files with 2,500 additions and 1,281 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# .git-blame-ignore-revs
# ignore initial move to black formatting
b9ae70bc9c1b1a07b3357ff9549d44b5bcd31182
5 changes: 3 additions & 2 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
etoolbox
footnote
- name: Setup Miniconda using Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: taxbrain-dev
environment-file: environment.yml
Expand All @@ -55,7 +55,8 @@ jobs:
run: |
pytest --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
file: ./coverage.xml
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/check_code_formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Check Black formatting

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: psf/black@stable
with:
options: "-l 79 --check"
src: "."
2 changes: 1 addition & 1 deletion cs-config/cs_config/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .functions import *
from .functions import *
246 changes: 166 additions & 80 deletions cs-config/cs_config/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,117 +12,193 @@
"validators": {
"choice": {
"choices": [
yr for yr in range(TaxBrain.FIRST_BUDGET_YEAR,
TaxBrain.LAST_BUDGET_YEAR + 1)
yr
for yr in range(
TaxBrain.FIRST_BUDGET_YEAR,
TaxBrain.LAST_BUDGET_YEAR + 1,
)
]
}
}
},
},
"MARS": {
"type": "str",
"validators": {"choice": {"choices": ["single", "mjoint",
"mseparate", "headhh",
"widow"]}}
"validators": {
"choice": {
"choices": [
"single",
"mjoint",
"mseparate",
"headhh",
"widow",
]
}
},
},
"idedtype": {
"type": "str",
"validators": {"choice": {"choices": ["med", "sltx", "retx", "cas",
"misc", "int", "char"]}}
"validators": {
"choice": {
"choices": [
"med",
"sltx",
"retx",
"cas",
"misc",
"int",
"char",
]
}
},
},
"EIC": {
"type": "str",
"validators": {"choice": {"choices": ["0kids", "1kid",
"2kids", "3+kids"]}}
"validators": {
"choice": {"choices": ["0kids", "1kid", "2kids", "3+kids"]}
},
},
"data_source": {
"type": "str",
"validators": {"choice": {"choices": ["PUF", "CPS", "other"]}}
}
"validators": {"choice": {"choices": ["PUF", "CPS", "other"]}},
},
},
"additional_members": {
"section_1": {"type": "str"},
"section_2": {"type": "str"},
"start_year": {"type": "int"},
"checkbox": {"type": "bool"}
}
"checkbox": {"type": "bool"},
},
}

AGG_ROW_NAMES = ['ind_tax', 'payroll_tax', 'combined_tax',
'benefit_cost_total']
AGG_ROW_NAMES = [
"ind_tax",
"payroll_tax",
"combined_tax",
"benefit_cost_total",
]

RESULTS_TABLE_TITLES = {
'diff_comb_xbin': ('Combined Payroll and Individual Income Tax: Difference'
' between Base and User plans by expanded income bin'),
'diff_comb_xdec': ('Combined Payroll and Individual Income Tax: Difference'
' between Base and User plans by expanded income '
'decile'),
'diff_itax_xbin': ('Individual Income Tax: Difference between Base and '
'User plans by expanded income bin'),
'diff_itax_xdec': ('Individual Income Tax: Difference between Base and '
'User plans by expanded income decile'),
'diff_ptax_xbin': ('Payroll Tax: Difference between Base and User plans '
'by expanded income bin'),
'diff_ptax_xdec': ('Payroll Tax: Difference between Base and User plans '
'by expanded income decile'),
'dist1_xbin': 'Base plan tax vars, weighted total by expanded income bin',
'dist1_xdec': ('Base plan tax vars, weighted total by expanded income '
'decile'),
'dist2_xbin': 'User plan tax vars, weighted total by expanded income bin',
'dist2_xdec': ('User plan tax vars, weighted total by expanded income '
'decile'),
'aggr_1': 'Total Liabilities Baseline by Calendar Year (Billions)',
'aggr_d': 'Total Liabilities Change by Calendar Year (Billions)',
'aggr_2': 'Total Liabilities Reform by Calendar Year (Billions)'}
"diff_comb_xbin": (
"Combined Payroll and Individual Income Tax: Difference"
" between Base and User plans by expanded income bin"
),
"diff_comb_xdec": (
"Combined Payroll and Individual Income Tax: Difference"
" between Base and User plans by expanded income "
"decile"
),
"diff_itax_xbin": (
"Individual Income Tax: Difference between Base and "
"User plans by expanded income bin"
),
"diff_itax_xdec": (
"Individual Income Tax: Difference between Base and "
"User plans by expanded income decile"
),
"diff_ptax_xbin": (
"Payroll Tax: Difference between Base and User plans "
"by expanded income bin"
),
"diff_ptax_xdec": (
"Payroll Tax: Difference between Base and User plans "
"by expanded income decile"
),
"dist1_xbin": "Base plan tax vars, weighted total by expanded income bin",
"dist1_xdec": (
"Base plan tax vars, weighted total by expanded income " "decile"
),
"dist2_xbin": "User plan tax vars, weighted total by expanded income bin",
"dist2_xdec": (
"User plan tax vars, weighted total by expanded income " "decile"
),
"aggr_1": "Total Liabilities Baseline by Calendar Year (Billions)",
"aggr_d": "Total Liabilities Change by Calendar Year (Billions)",
"aggr_2": "Total Liabilities Reform by Calendar Year (Billions)",
}

RESULTS_TABLE_TAGS = {
# diff tables
'diff_comb_xbin': {'table_type': 'diff', 'tax_type': 'combined',
'grouping': 'bins'},
'diff_comb_xdec': {'table_type': 'diff', 'tax_type': 'combined',
'grouping': 'deciles'},
'diff_itax_xbin': {'table_type': 'diff', 'tax_type': 'ind_income',
'grouping': 'bins'},
'diff_itax_xdec': {'table_type': 'diff', 'tax_type': 'ind_income',
'grouping': 'deciles'},
'diff_ptax_xbin': {'table_type': 'diff', 'tax_type': 'payroll',
'grouping': 'bins'},
'diff_ptax_xdec': {'table_type': 'diff', 'tax_type': 'payroll',
'grouping': 'deciles'},
"diff_comb_xbin": {
"table_type": "diff",
"tax_type": "combined",
"grouping": "bins",
},
"diff_comb_xdec": {
"table_type": "diff",
"tax_type": "combined",
"grouping": "deciles",
},
"diff_itax_xbin": {
"table_type": "diff",
"tax_type": "ind_income",
"grouping": "bins",
},
"diff_itax_xdec": {
"table_type": "diff",
"tax_type": "ind_income",
"grouping": "deciles",
},
"diff_ptax_xbin": {
"table_type": "diff",
"tax_type": "payroll",
"grouping": "bins",
},
"diff_ptax_xdec": {
"table_type": "diff",
"tax_type": "payroll",
"grouping": "deciles",
},
# dist tables
'dist1_xbin': {'table_type': 'dist', 'law': 'current',
'grouping': 'bins'},
'dist1_xdec': {'table_type': 'dist', 'law': 'current',
'grouping': 'deciles'},
'dist2_xbin': {'table_type': 'dist', 'law': 'reform',
'grouping': 'bins'},
'dist2_xdec': {'table_type': 'dist', 'law': 'reform',
'grouping': 'deciles'},
"dist1_xbin": {"table_type": "dist", "law": "current", "grouping": "bins"},
"dist1_xdec": {
"table_type": "dist",
"law": "current",
"grouping": "deciles",
},
"dist2_xbin": {"table_type": "dist", "law": "reform", "grouping": "bins"},
"dist2_xdec": {
"table_type": "dist",
"law": "reform",
"grouping": "deciles",
},
# aggr tables
'aggr_1': {'law': 'current'},
'aggr_d': {'law': 'change'},
'aggr_2': {'law': 'reform'},
"aggr_1": {"law": "current"},
"aggr_d": {"law": "change"},
"aggr_2": {"law": "reform"},
# gdp elaticity model table
'gdp_effect': {'default': 'gdp_elast'}
"gdp_effect": {"default": "gdp_elast"},
}
RESULTS_TOTAL_ROW_KEY_LABELS = {
'ind_tax': 'Individual Income Tax Liability',
'payroll_tax': 'Payroll Tax Liability',
'combined_tax': ('Combined Payroll and Individual Income Tax ' +
'Liability'),
'benefit_cost_total': 'Total Benefits Spending',
"ind_tax": "Individual Income Tax Liability",
"payroll_tax": "Payroll Tax Liability",
"combined_tax": (
"Combined Payroll and Individual Income Tax " + "Liability"
),
"benefit_cost_total": "Total Benefits Spending",
}

MONEY_VARS = {
"AGI", "Standard Deduction", "Itemized Deduction",
"Personal Exemption", "Taxable Income", "Regular Tax", "AMTI",
"Tax before Credits", "Non-refundable Credits", "Other Taxes",
"Refundable Credits", "Individual Income Tax Liabilities",
"AGI",
"Standard Deduction",
"Itemized Deduction",
"Personal Exemption",
"Taxable Income",
"Regular Tax",
"AMTI",
"Tax before Credits",
"Non-refundable Credits",
"Other Taxes",
"Refundable Credits",
"Individual Income Tax Liabilities",
"Payroll Tax Liablities",
"Combined Payroll and Individual Income Tax Liabilities",
"Universal Basic Income", "Total Cost of Benefits",
"Consumption Value of Benefits", "Expanded Income",
"After-Tax Expanded Income", "Average Tax Change",
"Total Tax Difference"
"Universal Basic Income",
"Total Cost of Benefits",
"Consumption Value of Benefits",
"Expanded Income",
"After-Tax Expanded Income",
"Average Tax Change",
"Total Tax Difference",
}


Expand All @@ -138,8 +214,18 @@ class MetaParameters(paramtools.Parameters):
"when": {
"param": "data_source",
"is": "CPS",
"then": {"range": {"min": 2014, "max": TaxBrain.LAST_BUDGET_YEAR}},
"otherwise": {"range": {"min": 2013, "max": TaxBrain.LAST_BUDGET_YEAR}},
"then": {
"range": {
"min": 2014,
"max": TaxBrain.LAST_BUDGET_YEAR,
}
},
"otherwise": {
"range": {
"min": 2013,
"max": TaxBrain.LAST_BUDGET_YEAR,
}
},
}
},
},
Expand All @@ -148,15 +234,15 @@ class MetaParameters(paramtools.Parameters):
"description": "CPS is currently the only supported data source",
"type": "str",
"value": "CPS",
"validators": {"choice": {"choices": ["CPS"]}}
"validators": {"choice": {"choices": ["CPS"]}},
},
"use_full_sample": {
"title": "Use Full Sample",
"description": "Use entire data set or a 2% sample.",
"type": "bool",
"value": True,
"validators": {"choice": {"choices": [True, False]}}
}
"validators": {"choice": {"choices": [True, False]}},
},
}

def dump(self, *args, **kwargs):
Expand Down
Loading

0 comments on commit 1a7e67f

Please sign in to comment.