How to use the Tax Calculator

All kinds of great text can go here, with links to relevant sites!

This is where we can put some great documentation

Different headings are available, and then you can go right to the code:


In [1]:
import sys
sys.path.append("../")
import taxcalc
from taxcalc import *
import pandas as pd
from pandas import DataFrame

Start with a default plan


In [2]:
# Default Plans
#Create a Public Use File object
tax_dta = pd.read_csv("../puf2.csv")
# Create a default Parameters object
params = Parameters(start_year=2013)
records = Records(tax_dta)
# Create a Calculator
calc1 = Calculator(records=records, parameters=params)

In [3]:
calc1.calc_all()

Then modify the existing tax code parameters


In [4]:
# User specified Plans
user_mods = '{"_rt4": [0.56]}'
params2 = Parameters(start_year=2013)
#Create a Public Use File object
tax_dta2 = pd.read_csv("../puf2.csv")
# Create a default Parameters object
records2 = Records(tax_dta)

# Create a Calculator
calc2 = calculator(parameters=params2, records=records2, mods=user_mods)

In [5]:
calc2.calc_all()

In [6]:
t1 = create_distribution_table(calc2, groupby="weighted_deciles")

In [7]:
t1


Out[7]:
c00100 c04100 c04470 c04800 c05200 c09600 c07100 c09200 _refund _ospctax c10300
wdecs
(0, 1425774560.8] -378616.878933 4795.945705 4930.988638 57.555292 5.755529 16334.883778 15.991279 17188.373897 137.342463 17051.031433 17161.500301
(1425774560.8, 2851549121.6] 8063.666633 1986.477609 2206.630780 1799.835413 180.009313 322.996661 8.913649 780.378860 713.969523 66.409337 662.503587
(2851549121.6, 4277323682.4] 14019.336573 1621.958699 3197.834089 4950.617503 517.601919 204.010324 86.064329 1035.519470 1352.067065 -316.547595 800.395196
(4277323682.4, 5703098243.2] 20385.448886 1309.247603 4169.295710 9505.866713 1075.731430 281.125864 194.325979 1537.244108 1215.948405 321.295703 1331.251551
(5703098243.2, 7128872804] 27911.141907 1086.668125 5426.389532 15057.624006 1805.838794 524.644823 298.489639 2460.765273 894.904528 1565.860746 2218.356362
(7128872804, 8554647364.8] 37219.055781 1071.944001 8139.944400 21901.541384 2750.774884 932.884519 336.862740 3849.897108 444.322845 3405.574263 3691.456473
(8554647364.8, 9980421925.6] 49738.054990 984.284448 11449.103604 30740.611634 4142.479228 378.362696 423.458426 4735.743661 179.279824 4556.463838 4648.911491
(9980421925.6, 11406196486.4] 66859.572831 1019.727294 15435.660467 43137.109888 6184.659567 1437.145556 516.021720 7924.595170 109.439495 7815.155675 7855.338693
(11406196486.4, 12831971047.2] 93545.648342 947.949836 23414.327645 61732.098344 9458.303518 1715.800637 605.137755 11866.139423 56.139182 11810.000242 11822.041769
(12831971047.2, 14257745608] 1648432.188941 272.616522 186717.751759 1465230.520696 555608.846885 28027.121752 17785.579102 476844.875042 4.262713 476840.612330 476841.220182

In [8]:
tdiff = create_difference_table(calc1, calc2, groupby="agi_bins")

In [9]:
tdiff


Out[9]:
tax_cut tax_inc count mean tot_change perc_inc perc_cut share_of_change
bins
(-100000000000000, 0] 0 0 208943736 0.000000 0.000000e+00 0.000000 0.000000 0.000000
(0, 9999] 0 0 2416798214 0.000000 0.000000e+00 0.000000 0.000000 0.000000
(9999, 19999] 0 0 2289136406 0.000000 0.000000e+00 0.000000 0.000000 0.000000
(19999, 29999] 0 0 1859220326 0.000000 0.000000e+00 0.000000 0.000000 0.000000
(29999, 39999] 0 0 1458517866 0.000000 0.000000e+00 0.000000 0.000000 0.000000
(39999, 49999] 0 0 1095710196 0.000000 0.000000e+00 0.000000 0.000000 0.000000
(49999, 74999] 0 0 1922982230 0.000000 0.000000e+00 0.000000 0.000000 0.000000
(74999, 99999] 0 12391487 1179289469 14.211983 1.676004e+10 0.010508 0.000000 0.002686
(99999, 200000] 998 166853146 1391525415 718.423979 9.997052e+11 0.119907 0.000001 0.160209
(200000, 100000000000000] 23471 351079961 435621750 11991.022880 5.223550e+12 0.805928 0.000054 0.837105

In [ ]: