taxcalc 4.2.1__py3-none-any.whl → 4.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- taxcalc/__init__.py +1 -1
- taxcalc/assumptions/ASSUMPTIONS.md +53 -0
- taxcalc/assumptions/README.md +17 -0
- taxcalc/assumptions/economic_assumptions_template.json +77 -0
- taxcalc/calcfunctions.py +7 -4
- taxcalc/data.py +10 -5
- taxcalc/policy.py +1 -1
- taxcalc/policy_current_law.json +4649 -288
- taxcalc/records.py +20 -15
- taxcalc/reforms/2017_law.json +125 -0
- taxcalc/reforms/2017_law.out.csv +10 -0
- taxcalc/reforms/ARPA.json +78 -0
- taxcalc/reforms/ARPA.out.csv +10 -0
- taxcalc/reforms/BrownKhanna.json +23 -0
- taxcalc/reforms/BrownKhanna.out.csv +10 -0
- taxcalc/reforms/CARES.json +40 -0
- taxcalc/reforms/CARES.out.csv +10 -0
- taxcalc/reforms/ConsolidatedAppropriationsAct2021.json +15 -0
- taxcalc/reforms/ConsolidatedAppropriationsAct2021.out.csv +10 -0
- taxcalc/reforms/Larson2019.json +36 -0
- taxcalc/reforms/Larson2019.out.csv +10 -0
- taxcalc/reforms/README.md +22 -0
- taxcalc/reforms/REFORMS.md +92 -0
- taxcalc/reforms/Renacci.json +61 -0
- taxcalc/reforms/Renacci.out.csv +10 -0
- taxcalc/reforms/SandersDeFazio.json +15 -0
- taxcalc/reforms/SandersDeFazio.out.csv +10 -0
- taxcalc/reforms/TCJA.json +160 -0
- taxcalc/reforms/TCJA.md +48 -0
- taxcalc/reforms/TCJA.out.csv +10 -0
- taxcalc/reforms/Trump2016.json +71 -0
- taxcalc/reforms/Trump2016.out.csv +10 -0
- taxcalc/reforms/Trump2017.json +51 -0
- taxcalc/reforms/Trump2017.out.csv +10 -0
- taxcalc/reforms/archive/Clinton2016.json +56 -0
- taxcalc/reforms/archive/RyanBrady.json +104 -0
- taxcalc/reforms/archive/TCJA_House.json +144 -0
- taxcalc/reforms/archive/TCJA_House_Amended.json +152 -0
- taxcalc/reforms/archive/TCJA_Reconciliation.json +187 -0
- taxcalc/reforms/archive/TCJA_Senate.json +116 -0
- taxcalc/reforms/archive/TCJA_Senate_111417.json +169 -0
- taxcalc/reforms/archive/TCJA_Senate_120117.json +174 -0
- taxcalc/reforms/cases.csv +10 -0
- taxcalc/reforms/clp.out.csv +10 -0
- taxcalc/reforms/ext.json +59 -0
- taxcalc/reforms/growfactors_ext.csv +65 -0
- taxcalc/reforms/ptaxes0.json +37 -0
- taxcalc/reforms/ptaxes0.out.csv +10 -0
- taxcalc/reforms/ptaxes1.json +21 -0
- taxcalc/reforms/ptaxes1.out.csv +10 -0
- taxcalc/reforms/ptaxes2.json +18 -0
- taxcalc/reforms/ptaxes2.out.csv +10 -0
- taxcalc/reforms/ptaxes3.json +28 -0
- taxcalc/reforms/ptaxes3.out.csv +10 -0
- taxcalc/taxcalcio.py +44 -22
- taxcalc/tests/benefits_expect.csv +169 -0
- taxcalc/tests/cmpi_cps_expect.txt +132 -0
- taxcalc/tests/cmpi_puf_expect.txt +132 -0
- taxcalc/tests/conftest.py +143 -0
- taxcalc/tests/cpscsv_agg_expect.csv +26 -0
- taxcalc/tests/puf_var_correl_coeffs_2016.csv +80 -0
- taxcalc/tests/puf_var_wght_means_by_year.csv +80 -0
- taxcalc/tests/pufcsv_agg_expect.csv +26 -0
- taxcalc/tests/pufcsv_mtr_expect.txt +63 -0
- taxcalc/tests/reforms.json +649 -0
- taxcalc/tests/reforms_expect.csv +65 -0
- taxcalc/tests/test_4package.py +67 -0
- taxcalc/tests/test_benefits.py +86 -0
- taxcalc/tests/test_calcfunctions.py +871 -0
- taxcalc/tests/test_calculator.py +1021 -0
- taxcalc/tests/test_compare.py +336 -0
- taxcalc/tests/test_compatible_data.py +338 -0
- taxcalc/tests/test_consumption.py +144 -0
- taxcalc/tests/test_cpscsv.py +163 -0
- taxcalc/tests/test_data.py +133 -0
- taxcalc/tests/test_decorators.py +332 -0
- taxcalc/tests/test_growdiff.py +102 -0
- taxcalc/tests/test_growfactors.py +94 -0
- taxcalc/tests/test_parameters.py +617 -0
- taxcalc/tests/test_policy.py +1557 -0
- taxcalc/tests/test_puf_var_stats.py +194 -0
- taxcalc/tests/test_pufcsv.py +385 -0
- taxcalc/tests/test_records.py +234 -0
- taxcalc/tests/test_reforms.py +386 -0
- taxcalc/tests/test_responses.py +41 -0
- taxcalc/tests/test_taxcalcio.py +755 -0
- taxcalc/tests/test_utils.py +792 -0
- taxcalc/validation/CSV_INPUT_VARS.md +29 -0
- taxcalc/validation/CSV_OUTPUT_VARS.md +63 -0
- taxcalc/validation/README.md +68 -0
- taxcalc/validation/taxsim35/Differences_Explained.md +54 -0
- taxcalc/validation/taxsim35/README.md +139 -0
- taxcalc/validation/taxsim35/expected_differences/a17-taxdiffs-expect.csv +25 -0
- taxcalc/validation/taxsim35/expected_differences/a18-taxdiffs-expect.csv +25 -0
- taxcalc/validation/taxsim35/expected_differences/a19-taxdiffs-expect.csv +25 -0
- taxcalc/validation/taxsim35/expected_differences/a20-taxdiffs-expect.csv +25 -0
- taxcalc/validation/taxsim35/expected_differences/a21-taxdiffs-expect.csv +25 -0
- taxcalc/validation/taxsim35/expected_differences/b17-taxdiffs-expect.csv +25 -0
- taxcalc/validation/taxsim35/expected_differences/b18-taxdiffs-expect.csv +25 -0
- taxcalc/validation/taxsim35/expected_differences/b19-taxdiffs-expect.csv +25 -0
- taxcalc/validation/taxsim35/expected_differences/b20-taxdiffs-expect.csv +25 -0
- taxcalc/validation/taxsim35/expected_differences/b21-taxdiffs-expect.csv +25 -0
- taxcalc/validation/taxsim35/expected_differences/c17-taxdiffs-expect.csv +25 -0
- taxcalc/validation/taxsim35/expected_differences/c18-taxdiffs-expect.csv +25 -0
- taxcalc/validation/taxsim35/expected_differences/c19-taxdiffs-expect.csv +25 -0
- taxcalc/validation/taxsim35/input_setup.py +67 -0
- taxcalc/validation/taxsim35/main_comparison.py +183 -0
- taxcalc/validation/taxsim35/prepare_taxcalc_input.py +161 -0
- taxcalc/validation/taxsim35/process_taxcalc_output.py +140 -0
- taxcalc/validation/taxsim35/taxsim_emulation.json +49 -0
- taxcalc/validation/taxsim35/taxsim_input.py +321 -0
- taxcalc/validation/taxsim35/tc_sims.py +98 -0
- taxcalc/validation/taxsim35/tests_35.py +80 -0
- taxcalc/validation/tests_35.sh +13 -0
- {taxcalc-4.2.1.dist-info → taxcalc-4.3.0.dist-info}/METADATA +3 -4
- taxcalc-4.3.0.dist-info/RECORD +139 -0
- {taxcalc-4.2.1.dist-info → taxcalc-4.3.0.dist-info}/WHEEL +1 -1
- taxcalc/tmd_growfactors.csv +0 -55
- taxcalc/tmd_weights.csv.gz +0 -0
- taxcalc-4.2.1.dist-info/RECORD +0 -34
- {taxcalc-4.2.1.dist-info → taxcalc-4.3.0.dist-info}/LICENSE +0 -0
- {taxcalc-4.2.1.dist-info → taxcalc-4.3.0.dist-info}/entry_points.txt +0 -0
- {taxcalc-4.2.1.dist-info → taxcalc-4.3.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,65 @@
|
|
1
|
+
rid,res1,res2,res3,res4
|
2
|
+
1,63.8,64.9,68.1,71.0
|
3
|
+
2,52.1,56.2,51.1,59.3
|
4
|
+
3,76.4,77.7,81.8,85.8
|
5
|
+
4,-0.3,-0.3,-0.3,-0.4
|
6
|
+
5,0.7,0.7,0.8,0.9
|
7
|
+
6,37.9,37.8,39.4,40.8
|
8
|
+
7,7.2,7.4,7.5,7.9
|
9
|
+
8,1.9,1.9,2.1,2.2
|
10
|
+
9,3.8,3.8,4.2,4.6
|
11
|
+
10,6.7,7.1,7.4,7.7
|
12
|
+
11,3.1,3.3,3.6,3.8
|
13
|
+
12,0.1,0.1,0.1,0.1
|
14
|
+
13,-33.2,-32.0,-34.7,-36.1
|
15
|
+
14,-0.1,-0.1,-0.1,-0.1
|
16
|
+
15,0.1,0.1,0.1,0.2
|
17
|
+
16,-1.0,-1.0,-1.5,-1.6
|
18
|
+
17,-0.2,-0.2,-0.3,-0.3
|
19
|
+
18,33.4,34.7,37.1,39.3
|
20
|
+
19,63.8,65.5,70.8,76.3
|
21
|
+
20,97.9,101.5,109.4,116.0
|
22
|
+
21,65.9,67.8,72.8,76.9
|
23
|
+
22,9.7,10.3,10.6,11.2
|
24
|
+
23,0.5,0.6,0.6,0.6
|
25
|
+
24,50.4,52.6,55.8,59.4
|
26
|
+
25,1.9,2.0,2.1,2.2
|
27
|
+
26,0.1,0.1,0.1,0.1
|
28
|
+
27,0.1,0.1,0.1,0.1
|
29
|
+
28,3.8,3.7,4.2,4.6
|
30
|
+
29,17.9,18.4,20.6,22.2
|
31
|
+
30,14.7,13.3,17.2,18.6
|
32
|
+
31,-6.6,-6.4,-1.6,-1.6
|
33
|
+
32,57.4,57.9,61.8,65.4
|
34
|
+
33,12.0,11.5,13.3,14.5
|
35
|
+
34,7.5,7.1,8.3,9.1
|
36
|
+
35,-1.2,-0.9,-1.5,-1.6
|
37
|
+
36,-2.9,-2.8,-3.5,-3.7
|
38
|
+
37,3.1,3.2,3.6,3.9
|
39
|
+
38,29.8,30.9,34.1,36.3
|
40
|
+
39,9.2,9.6,10.5,11.3
|
41
|
+
40,-0.6,-0.5,-0.7,-0.7
|
42
|
+
41,54.0,52.3,51.2,50.2
|
43
|
+
42,0.5,0.6,0.6,0.6
|
44
|
+
43,-0.2,-0.2,-0.2,-0.2
|
45
|
+
44,70.6,68.8,67.9,68.9
|
46
|
+
45,1.2,1.1,1.1,1.2
|
47
|
+
46,-2.1,-2.0,-2.2,-2.2
|
48
|
+
47,-2.1,-1.8,-2.1,-2.2
|
49
|
+
48,-0.8,-0.8,-0.8,-0.7
|
50
|
+
49,-0.0,-0.0,-0.0,-0.0
|
51
|
+
50,-26.5,-23.7,-31.1,-33.9
|
52
|
+
51,-0.3,-0.3,-0.5,-0.5
|
53
|
+
52,-187.0,-187.5,-193.6,-200.7
|
54
|
+
53,-130.0,-129.3,-132.7,-136.9
|
55
|
+
54,31.3,33.8,32.1,41.9
|
56
|
+
55,86.1,90.9,95.0,102.5
|
57
|
+
56,0.0,0.0,0.0,0.0
|
58
|
+
57,-14.1,-15.6,-16.0,-14.5
|
59
|
+
58,-15.5,-17.1,-17.5,-15.9
|
60
|
+
59,-66.1,-66.2,-66.2,-66.4
|
61
|
+
60,-67.3,-67.2,-67.3,-67.4
|
62
|
+
61,-1.0,-0.5,-0.6,-1.3
|
63
|
+
62,-17.2,-17.7,-23.8,-19.4
|
64
|
+
63,-12.7,-13.0,-23.4,-13.8
|
65
|
+
64,-46.9,-47.9,-48.8,-51.3
|
@@ -0,0 +1,67 @@
|
|
1
|
+
"""
|
2
|
+
Tests for package existence and dependencies consistency.
|
3
|
+
"""
|
4
|
+
# CODING-STYLE CHECKS:
|
5
|
+
# pycodestyle test_4package.py
|
6
|
+
# pylint --disable=locally-disabled test_4package.py
|
7
|
+
|
8
|
+
import os
|
9
|
+
import re
|
10
|
+
import subprocess
|
11
|
+
import yaml
|
12
|
+
import pytest
|
13
|
+
|
14
|
+
|
15
|
+
@pytest.mark.local
|
16
|
+
def test_for_package_existence():
|
17
|
+
"""
|
18
|
+
Ensure that no conda taxcalc package is installed when running pytest.
|
19
|
+
Primarily to help developers catch mistaken installations of taxcalc;
|
20
|
+
the local mark prevents test from running on GitHub.
|
21
|
+
"""
|
22
|
+
out = subprocess.check_output(['conda', 'list', 'taxcalc']).decode('ascii')
|
23
|
+
envless_out = out.replace('taxcalc-dev', 'environment')
|
24
|
+
if re.search('taxcalc', envless_out) is not None:
|
25
|
+
assert 'taxcalc package' == 'installed'
|
26
|
+
|
27
|
+
|
28
|
+
def test_for_consistency(tests_path):
|
29
|
+
"""
|
30
|
+
Ensure that there is consistency between environment.yml dependencies
|
31
|
+
and conda.recipe/meta.yaml requirements.
|
32
|
+
"""
|
33
|
+
dev_pkgs = set([
|
34
|
+
'pytest',
|
35
|
+
'pytest-xdist',
|
36
|
+
'pycodestyle',
|
37
|
+
'pylint',
|
38
|
+
'coverage',
|
39
|
+
"pip",
|
40
|
+
"jupyter-book",
|
41
|
+
])
|
42
|
+
# read conda.recipe/meta.yaml requirements
|
43
|
+
meta_file = os.path.join(tests_path, '..', '..',
|
44
|
+
'conda.recipe', 'meta.yaml')
|
45
|
+
with open(meta_file, 'r') as stream:
|
46
|
+
meta = yaml.safe_load(stream)
|
47
|
+
bld = set(meta['requirements']['build'])
|
48
|
+
run = set(meta['requirements']['run'])
|
49
|
+
# confirm conda.recipe/meta.yaml build and run requirements are the same
|
50
|
+
assert bld == run
|
51
|
+
# read environment.yml dependencies
|
52
|
+
envr_file = os.path.join(tests_path, '..', '..',
|
53
|
+
'environment.yml')
|
54
|
+
with open(envr_file, 'r') as stream:
|
55
|
+
envr = yaml.safe_load(stream)
|
56
|
+
|
57
|
+
env = []
|
58
|
+
for dep in envr["dependencies"]:
|
59
|
+
if isinstance(dep, dict):
|
60
|
+
assert list(dep.keys()) == ["pip"]
|
61
|
+
env += dep["pip"]
|
62
|
+
else:
|
63
|
+
env.append(dep)
|
64
|
+
env = set(env)
|
65
|
+
# confirm that extras in env (relative to run) equal the dev_pkgs set
|
66
|
+
extras = env - run
|
67
|
+
assert extras == dev_pkgs
|
@@ -0,0 +1,86 @@
|
|
1
|
+
"""
|
2
|
+
Tests of Tax-Calculator benefits.
|
3
|
+
|
4
|
+
Note that the CPS-related files that are required to run this program
|
5
|
+
have been constructed by the Tax-Calculator development team from publicly
|
6
|
+
available Census data files. Hence, the CPS-related files are freely
|
7
|
+
available and are part of the Tax-Calculator repository.
|
8
|
+
|
9
|
+
Read Tax-Calculator/TESTING.md for details.
|
10
|
+
"""
|
11
|
+
# CODING-STYLE CHECKS:
|
12
|
+
# pycodestyle test_benefits.py
|
13
|
+
# pylint --disable=locally-disabled test_benefits.py
|
14
|
+
|
15
|
+
import os
|
16
|
+
import pytest
|
17
|
+
import numpy as np
|
18
|
+
import pandas as pd
|
19
|
+
# pylint: disable=import-error
|
20
|
+
from taxcalc import Policy, Records, Calculator
|
21
|
+
|
22
|
+
|
23
|
+
@pytest.mark.benefits
|
24
|
+
def test_benefits(tests_path, cps_fullsample):
|
25
|
+
"""
|
26
|
+
Test CPS benefits from 2015 thru 2034.
|
27
|
+
"""
|
28
|
+
# pylint: disable=too-many-locals
|
29
|
+
benefit_names = ['ssi', 'mcare', 'mcaid', 'snap', 'wic',
|
30
|
+
'tanf', 'vet', 'housing']
|
31
|
+
# write benefits_actual.csv file
|
32
|
+
recs = Records.cps_constructor(data=cps_fullsample)
|
33
|
+
start_year = recs.current_year
|
34
|
+
calc = Calculator(policy=Policy(), records=recs, verbose=False)
|
35
|
+
assert calc.current_year == start_year
|
36
|
+
year_list = list()
|
37
|
+
bname_list = list()
|
38
|
+
benamt_list = list()
|
39
|
+
bencnt_list = list()
|
40
|
+
benavg_list = list()
|
41
|
+
for year in range(start_year, 2034 + 1):
|
42
|
+
calc.advance_to_year(year)
|
43
|
+
size = calc.array('XTOT')
|
44
|
+
wght = calc.array('s006')
|
45
|
+
# compute benefit aggregate amounts and head counts and average benefit
|
46
|
+
# (head counts include all members of filing unit receiving a benefit,
|
47
|
+
# which means benavg is f.unit benefit amount divided by f.unit size)
|
48
|
+
for bname in benefit_names:
|
49
|
+
ben = calc.array('{}_ben'.format(bname))
|
50
|
+
benamt = round((ben * wght).sum() * 1e-9, 3)
|
51
|
+
bencnt = round((size[ben > 0] * wght[ben > 0]).sum() * 1e-6, 3)
|
52
|
+
benavg = round(benamt / bencnt, 1)
|
53
|
+
year_list.append(year)
|
54
|
+
bname_list.append(bname)
|
55
|
+
benamt_list.append(benamt)
|
56
|
+
bencnt_list.append(bencnt)
|
57
|
+
benavg_list.append(benavg)
|
58
|
+
adict = {'year': year_list,
|
59
|
+
'bname': bname_list,
|
60
|
+
'benamt': benamt_list,
|
61
|
+
'bencnt': bencnt_list,
|
62
|
+
'benavg': benavg_list}
|
63
|
+
adf = pd.DataFrame(data=adict,
|
64
|
+
columns=['year', 'bname', 'benamt', 'bencnt', 'benavg'])
|
65
|
+
ben_act_path = os.path.join(tests_path, 'benefits_actual.csv')
|
66
|
+
adf.to_csv(ben_act_path, index=False)
|
67
|
+
# read benefits_expect.csv file
|
68
|
+
ben_exp_path = os.path.join(tests_path, 'benefits_expect.csv')
|
69
|
+
edf = pd.read_csv(ben_exp_path)
|
70
|
+
# compare benefit information
|
71
|
+
atol = 0.0001
|
72
|
+
rtol = 0.0
|
73
|
+
diffs = False
|
74
|
+
for col in ['benamt', 'bencnt', 'benavg']:
|
75
|
+
if not np.allclose(adf[col], edf[col], atol=atol, rtol=rtol):
|
76
|
+
diffs = True
|
77
|
+
if diffs:
|
78
|
+
msg = 'CPS BENEFITS RESULTS DIFFER\n'
|
79
|
+
msg += '-------------------------------------------------\n'
|
80
|
+
msg += '--- NEW RESULTS IN benefits_actual.txt FILE ---\n'
|
81
|
+
msg += '--- if new OK, copy benefits_actual.txt to ---\n'
|
82
|
+
msg += '--- benefits_expect.txt ---\n'
|
83
|
+
msg += '--- and rerun test. ---\n'
|
84
|
+
msg += '-------------------------------------------------\n'
|
85
|
+
raise ValueError(msg)
|
86
|
+
os.remove(ben_act_path)
|