Open MaxGhenis opened 1 day ago
Here is the SAS program I am using. It creates a test dataset, then calculates with both tax calculators, and then presents the 6 worst comparisons in a table with vars down the side.
Here is a sample output:
You can see some differences here. We discussed fica this morning, I'll have comments on fiitax later.
It looks like state may be a required variable in the emulator. In taxsim it defaults to zero. Here I submit a taxpayer with only year,pwages,mstat and idtl specified.
sas1 taxsim: cat txpydata.csv
year,pwages,mstat,idtl
2021,49000,1,2
sas1 taxsim: python3.12 ../policyengine-taxsim/taxsim_emulator.py txpydata.csv
running script
Traceback (most recent call last):
File "/usr/local/lib64/python3.12/site-packages/pandas/core/indexes/base.py", line 3805, in get_loc
return self._engine.get_loc(casted_key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "index.pyx", line 167, in pandas._libs.index.IndexEngine.get_loc
File "index.pyx", line 196, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 7081, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 7089, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'state'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/disk/homedirs/nber/taxsim/petest/../policyengine-taxsim/taxsim_emulator.py", line 402, in <module>
main(args.input_file)
File "/disk/homedirs/nber/taxsim/petest/../policyengine-taxsim/taxsim_emulator.py", line 383, in main
reader = read_input_file(input_file)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/disk/homedirs/nber/taxsim/petest/../policyengine-taxsim/taxsim_emulator.py", line 13, in read_input_file
reader = InputReader(input_file)
^^^^^^^^^^^^^^^^^^^^^^^
File "/disk/homedirs/nber/taxsim/policyengine-taxsim/TaxsimInputReader.py", line 13, in __init__
self.situations = self.get_situations()
^^^^^^^^^^^^^^^^^^^^^
File "/disk/homedirs/nber/taxsim/policyengine-taxsim/TaxsimInputReader.py", line 203, in get_situations
situation = self.create_situation(row)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/disk/homedirs/nber/taxsim/policyengine-taxsim/TaxsimInputReader.py", line 158, in create_situation
state = self.get_state_code(row['state'])
~~~^^^^^^^^^
File "/usr/local/lib64/python3.12/site-packages/pandas/core/series.py", line 1121, in __getitem__
return self._get_value(key)
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib64/python3.12/site-packages/pandas/core/series.py", line 1237, in _get_value
loc = self.index.get_loc(label)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib64/python3.12/site-packages/pandas/core/indexes/base.py", line 3812, in get_loc
raise KeyError(key) from err
KeyError: 'state'
sas1 taxsim:
In case you are confused by the sas output - the underscore indeicates a value from taxsim, without an underscore is a value from policyengine. The 6 columns are each a different taxpayer, there are only two used in this example becaise there are only 2 records in the datafile.
I took COL1 and entered the same data into TaxAct. Note that the PolicyEngine standard deduction and fiitax are both different from TaxAct. zbe ahouls be 12550, and tax should be 2775 (after 1400 rebate). The taxsim input file is:
year,state,depx,pwages,mstat,mortgage,taxsimid,idtl
2021,3,0,49000,1,0,1,2
The filled out tax form is:
pe a 2021 Federal Form 1040.pdf
I am using taxsim test. You can download the executables from http://taxsim.nber.org/taxsimtest/windows or http://taxsim.nber.org/taxsimtest/osx
Taxsim-test specifically.
@feenberg offered to share SAS code and results, which we can translate to Python and include in CI.