Static Reform

This notebook contains an example for how to use the taxbrain python package

from taxbrain import TaxBrain, differences_plot, distribution_plot
reform_url = "https://raw.githubusercontent.com/PSLmodels/Tax-Calculator/master/taxcalc/reforms/Larson2019.json"
start_year = 2021
end_year = 2030

Static Reform#

After importing the TaxBrain class from the taxbrain package, we initiate an instance of the class by specifying the start and end year of the anlaysis, which microdata to use, and a policy reform. Additional arguments can be used to specify econoimc assumptions and individual behavioral elasticites.

Once the class has been initiated, the run() method will handle executing each model

tb_static = TaxBrain(start_year, end_year, use_cps=True, reform=reform_url)
tb_static.run()

Once the calculators have been run, you can produce a number of tables, including a weighted total of a given variable each year under both current law and the user reform.

print("Combined Tax Liability Over the Budget Window")
tb_static.weighted_totals("combined")
Combined Tax Liability Over the Budget Window
2021 2022 2023 2024 2025 2026 2027 2028 2029 2030
Base 2.268028e+12 3.096166e+12 3.213183e+12 3.353333e+12 3.527652e+12 3.921699e+12 4.097372e+12 4.273907e+12 4.462825e+12 4.655436e+12
Reform 2.325068e+12 3.174432e+12 3.309377e+12 3.467973e+12 3.662834e+12 4.070283e+12 4.266411e+12 4.464527e+12 4.663195e+12 4.865832e+12
Difference 5.704073e+10 7.826675e+10 9.619325e+10 1.146401e+11 1.351819e+11 1.485843e+11 1.690389e+11 1.906206e+11 2.003697e+11 2.103964e+11

If you are interested in a detailed look on the reform’s effect, you can produce a differences table for a given year.

print("Differences Table")
tb_static.differences_table(start_year, "weighted_deciles", "combined")
Differences Table
count tax_cut perc_cut tax_inc perc_inc mean tot_change share_of_change ubi benefit_cost_total benefit_value_total pc_aftertaxinc
0-10n 0.102049 0.000000 0.000000 0.035165 34.458500 8.218450 0.000839 0.001470 0.0 0.0 0.0 0.006304
0-10z 8.391348 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.0 0.0 0.0 0.000000
0-10p 12.213912 0.000000 0.000000 5.512064 45.129394 3.694912 0.045129 0.079118 0.0 0.0 0.0 -0.030308
10-20 20.707719 0.000000 0.000000 15.024911 72.557053 17.183407 0.355829 0.623816 0.0 0.0 0.0 -0.049667
20-30 20.707209 0.019010 0.091802 13.227202 63.877280 26.991785 0.558925 0.979869 0.0 0.0 0.0 -0.047428
30-40 20.707414 0.259493 1.253142 11.851219 57.231765 29.342684 0.607611 1.065223 0.0 0.0 0.0 -0.036821
40-50 20.707314 1.017622 4.914311 12.911845 62.354033 27.950700 0.578784 1.014685 0.0 0.0 0.0 -0.014438
50-60 20.708056 2.995433 14.465061 12.844997 62.028988 -36.867881 -0.763462 -1.338451 0.0 0.0 0.0 0.111299
60-70 20.706520 3.809639 18.398257 12.695252 61.310408 -154.654147 -3.202349 -5.614145 0.0 0.0 0.0 0.261004
70-80 20.707762 4.051343 19.564367 13.340003 64.420304 -199.992490 -4.141397 -7.260421 0.0 0.0 0.0 0.273015
80-90 20.706344 4.430289 21.395804 14.287998 69.002997 -429.479458 -8.892949 -15.590526 0.0 0.0 0.0 0.418412
90-100 20.709729 1.427188 6.891390 17.358077 83.816051 3471.497416 71.893769 126.039361 0.0 0.0 0.0 -1.295898
ALL 207.075375 18.010016 8.697324 129.088733 62.339007 275.458769 57.040728 100.000000 0.0 0.0 0.0 -0.321414
90-95 10.355767 1.287196 12.429747 8.243016 79.598317 -297.884968 -3.084827 -5.408114 0.0 0.0 0.0 0.256537
95-99 8.283195 0.139992 1.690078 7.285869 87.959648 312.562973 2.589020 4.538897 0.0 0.0 0.0 -0.068107
Top 1% 2.070766 0.000000 0.000000 1.829191 88.334013 34957.870299 72.389576 126.908577 0.0 0.0 0.0 -4.364074

TaxBrain comes with two (and counting) built in plots as well

differences_plot(tb_static, 'combined', figsize=(10, 8));
../../_images/b233db55f1e76cedff00da2436a253baf814d28f14e952e2de5febc54295b81c.png
distribution_plot(tb_static, 2021, figsize=(10, 8));
../../_images/961dd66146756a6f0c74ef43eb6c154614f79cc8eedf4cba66b730111205c553.png

You can run a partial-equlibrium dynamic simulation by initiating the TaxBrian instance exactly as you would for the static reform, but with your behavioral assumptions specified

tb_dynamic = TaxBrain(start_year, end_year, use_cps=True, reform=reform_url,
                      behavior={"sub": 0.25})
tb_dynamic.run()

Once that finishes running, we can produce the same weighted total table as we did with the static run.

print("Partial Equilibrium - Combined Tax Liability")
tb_dynamic.weighted_totals("combined")
Partial Equilibrium - Combined Tax Liability
2021 2022 2023 2024 2025 2026 2027 2028 2029 2030
Base 2.268028e+12 3.096166e+12 3.213183e+12 3.353333e+12 3.527652e+12 3.921699e+12 4.097372e+12 4.273907e+12 4.462825e+12 4.655436e+12
Reform 2.306036e+12 3.147545e+12 3.279764e+12 3.435419e+12 3.627030e+12 4.027664e+12 4.219799e+12 4.413940e+12 4.610049e+12 4.812248e+12
Difference 3.800795e+10 5.137927e+10 6.658024e+10 8.208544e+10 9.937838e+10 1.059651e+11 1.224272e+11 1.400334e+11 1.472237e+11 1.568118e+11

Or we can produce a distribution table to see details on the effects of the reform.

print("Distribution Table")
tb_dynamic.distribution_table(start_year, "weighted_deciles", "expanded_income", "reform")
Distribution Table
count c00100 count_StandardDed standard count_ItemDed c04470 c04600 c04800 taxbc c62100 ... othertaxes refund iitax payrolltax combined ubi benefit_cost_total benefit_value_total expanded_income aftertax_income
0-10n 0.102049 -7.649244 0.102049 1.812331 0.000000 0.000000 0.0 0.000000 0.000000 -7.649244 ... 0.000000 0.354646 -0.354646 0.064998 -0.289648 0.0 0.799655 0.799655 -6.942145 -6.652498
0-10z 8.391348 -0.092134 8.391348 112.606869 0.000000 0.000000 0.0 0.000000 0.000000 -0.092134 ... 0.000000 17.779859 -17.779859 0.000000 -17.779859 0.0 0.000000 0.000000 0.000000 17.779859
0-10p 12.213637 28.259073 12.209500 167.006485 0.004137 0.020215 0.0 0.114706 0.004012 28.239184 ... 0.000000 28.401750 -28.397738 3.495657 -24.902081 0.0 19.567499 19.567499 50.337944 75.240025
10-20 20.707630 206.860145 20.173601 279.073385 0.534030 8.393339 0.0 26.159500 2.418830 199.241677 ... 0.000000 68.988629 -66.570284 27.592705 -38.977579 0.0 107.361255 107.361255 323.068092 362.045671
20-30 20.707284 316.342494 19.633727 286.706839 1.073557 19.045036 0.0 116.697579 11.638357 299.564633 ... 0.000000 67.738392 -56.093025 43.585241 -12.507784 0.0 258.295588 258.295588 590.652917 603.160701
30-40 20.708037 392.536201 19.511127 297.128138 1.196909 22.216820 0.0 185.664189 19.386879 373.573434 ... 0.000000 67.114842 -47.714884 53.592431 5.877547 0.0 369.313500 369.313500 787.593400 781.715853
40-50 20.707352 550.188644 18.989982 306.143642 1.717370 34.434531 0.0 287.673231 30.614947 521.750746 ... 0.000000 78.255298 -47.631283 72.865300 25.234017 0.0 404.510126 404.510126 994.329747 969.095730
50-60 20.707858 735.450902 18.281486 324.340414 2.426372 50.251225 0.0 426.640889 47.219121 695.558808 ... 0.000000 93.096955 -45.871582 95.831669 49.960088 0.0 466.953272 466.953272 1257.807277 1207.847189
60-70 20.707239 959.250996 17.711594 354.189852 2.995645 64.791920 0.0 607.232422 72.412781 909.916077 ... 0.000000 112.431110 -40.008837 122.156637 82.147799 0.0 578.175610 578.175610 1602.675994 1520.528195
70-80 20.707365 1364.757121 16.535283 368.004233 4.172082 102.236540 0.0 942.537439 119.150684 1289.298141 ... 0.000000 121.709709 -2.537579 172.485952 169.948373 0.0 634.318676 634.318676 2084.657860 1914.709486
80-90 20.707509 2092.253684 14.370639 343.627507 6.336871 184.540747 0.0 1578.989767 218.757862 1957.951848 ... 0.004232 125.381287 93.403197 257.242142 350.645338 0.0 640.544708 640.544708 2871.007071 2520.361733
90-100 20.708067 6230.716762 9.263076 228.650643 11.444991 391.404934 0.0 5593.140056 1195.027525 5945.348021 ... 13.799675 47.770914 1162.771035 553.908371 1716.679406 0.0 513.133299 513.133299 6972.266959 5255.587552
ALL 207.075375 12868.874646 175.173413 3069.290336 31.901963 877.335305 0.0 9764.849779 1716.630998 12212.701191 ... 13.803907 829.023390 903.214514 1402.821103 2306.035617 0.0 3992.973188 3992.973188 17527.455114 15221.419497
90-95 10.354038 1665.559602 5.585355 138.035489 4.768683 150.458191 0.0 1373.129891 220.110505 1558.197056 ... 0.030247 34.083831 186.077892 188.944751 375.022643 0.0 285.403221 285.403221 2037.860868 1662.838225
95-99 8.282851 2336.982680 3.205105 79.313010 5.077747 172.650622 0.0 2071.540730 396.259857 2211.787530 ... 1.295661 13.632805 384.295574 212.123504 596.419078 0.0 191.874589 191.874589 2623.200529 2026.781451
Top 1% 2.071178 2228.174479 0.472617 11.302143 1.598561 68.296121 0.0 2148.469436 578.657164 2175.363435 ... 12.473767 0.054278 592.397569 152.840116 745.237685 0.0 35.855489 35.855489 2311.205561 1565.967876

16 rows × 24 columns