How to use Tax-Calculator

This guide teaches you how to use Tax-Calculator. To follow along you will need the following:

  1. A copy of the taxcalc package installed on your local machine.
  2. A copy of the puf.csv file output from the TaxData repository.

Import taxcalc package and other useful packages

In [3]:
import sys
sys.path.append("../../")
from taxcalc import *

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

In [4]:
# The baseline includes AMT repeal. 
p_xx = Policy()
reform_xx = {
    2017: {
        '_AMT_rt1': [0.0],
        '_AMT_rt2': [0.0]
    }
}
p_xx.implement_reform(reform_xx)

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

p_yy = Policy()
reform_yy = {
    2017: {
        '_II_brk2': [[65005, 130010, 65005, 88180, 0]],
        '_AMT_rt1': [0.0],
        '_AMT_rt2': [0.0]
    }
}
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.
In [5]:
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 2017 for this analysis.

In [6]:
c_xx.advance_to_year(2017)
c_yy.advance_to_year(2017)
assert c_xx.current_year == 2017
assert c_yy.current_year == 2017

Calculate taxes under the baseline and under the reform.

In [7]:
c_xx.calc_all()
c_yy.calc_all()

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

In [8]:
((c_yy.records.combined - c_xx.records.combined)*c_xx.records.s006).sum()
Out[8]:
-102894721202.03145