diff --git a/docs/cruncher_demo.ipynb b/docs/cruncher_demo.ipynb
new file mode 100644
index 0000000..fd32376
--- /dev/null
+++ b/docs/cruncher_demo.ipynb
@@ -0,0 +1,1556 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Batch analysis\n",
+ "\n",
+ "The `Batch:` class allows users to analyze the tax liabilities of a batch of filing units under current law and under a tax policy reform. \n",
+ "\n",
+ "## Inputs\n",
+ "\n",
+ "The class is initialized with a file path to CSV input -- each column contains data on a different tax information variable (e.g. year, marital status, wages, etc.) and each row represents a different filing unit. A detailed discussion of the inputs is [here](https://github.com/PSLmodels/Tax-Cruncher/blob/master/docs/INPUT_INSTRUCTIONS.md)."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# import the Batch class\n",
+ "from taxcrunch.multi_cruncher import Batch"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# path to input csv file\n",
+ "path = '../docs/example_input.csv'\n",
+ "\n",
+ "# initialize an object of the Batch class\n",
+ "b = Batch(path)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Outputs\n",
+ "\n",
+ "Now, we can create a few tables that will show us a detailed breakdown of each filing unit's tax liabilities.\n",
+ "\n",
+ "- The `create_table()` method returns a Pandas DataFrame in which each row is a filing unit and each column is an aspect of its tax burden under current law or policy reform. The `write_output_file()` method writes the table as a CSV file.\n",
+ "\n",
+ "- The `create_diff_table()` method returns a difference table, where each column shows the difference between liabilities under current law and under policy reform. The `write_diff_file()` method writes the difference table as a CSV file.\n",
+ "\n",
+ "To analyze a policy reform, specify the `reform_file` argument in any of the table-making methods. You may enter the file path to a json reform file, a dictionary, or the URL to a reform in the [Tax-Calculator repository](https://github.com/PSLmodels/Tax-Calculator/tree/master/taxcalc/reforms). Make sure that you reform adheres to Tax-Calculator [standards](https://github.com/PSLmodels/Tax-Calculator/blob/master/taxcalc/reforms/REFORMS.md). "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " ID | \n",
+ " Individual Income Tax | \n",
+ " Payroll Tax | \n",
+ " Wages | \n",
+ " AGI | \n",
+ " UI in AGI | \n",
+ " OASDI in AGI | \n",
+ " Itemized Deductions | \n",
+ " Taxable Inc | \n",
+ " Regular Tax | \n",
+ " ... | \n",
+ " Child care credit | \n",
+ " EITC | \n",
+ " AMT Taxable Income | \n",
+ " AMT Liability | \n",
+ " Net Investment Income Tax | \n",
+ " Income Tax Before Credits | \n",
+ " FICA | \n",
+ " Payroll Tax MTR | \n",
+ " Income Tax MTR | \n",
+ " Combined MTR | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 | \n",
+ " 1.0 | \n",
+ " 23397.147200 | \n",
+ " 21137.96192 | \n",
+ " 160000.0 | \n",
+ " 164500.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 146096.8 | \n",
+ " 27397.1472 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 164500.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 27397.1472 | \n",
+ " 21137.96192 | \n",
+ " 0.029 | \n",
+ " 0.2400 | \n",
+ " 0.2690 | \n",
+ "
\n",
+ " \n",
+ " 1 | \n",
+ " 2.0 | \n",
+ " -5385.396064 | \n",
+ " 7267.50000 | \n",
+ " 47500.0 | \n",
+ " 47800.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 23262.4 | \n",
+ " 2365.9536 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 1751.349664 | \n",
+ " 47800.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 2365.9536 | \n",
+ " 7267.50000 | \n",
+ " 0.153 | \n",
+ " 0.3306 | \n",
+ " 0.4836 | \n",
+ "
\n",
+ " \n",
+ " 2 | \n",
+ " 3.0 | \n",
+ " 10049.408800 | \n",
+ " 10710.00000 | \n",
+ " 70000.0 | \n",
+ " 80000.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 67731.2 | \n",
+ " 10049.4088 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 80000.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 10049.4088 | \n",
+ " 10710.00000 | \n",
+ " 0.153 | \n",
+ " 0.2200 | \n",
+ " 0.3730 | \n",
+ "
\n",
+ " \n",
+ " 3 | \n",
+ " 4.0 | \n",
+ " 7538.817600 | \n",
+ " 18819.00000 | \n",
+ " 123000.0 | \n",
+ " 124200.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 99662.4 | \n",
+ " 13538.8176 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 124200.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 13538.8176 | \n",
+ " 18819.00000 | \n",
+ " 0.153 | \n",
+ " 0.2200 | \n",
+ " 0.3730 | \n",
+ "
\n",
+ " \n",
+ " 4 | \n",
+ " 5.0 | \n",
+ " 40659.745600 | \n",
+ " 23747.96192 | \n",
+ " 250000.0 | \n",
+ " 251200.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 226662.4 | \n",
+ " 42614.1456 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 251200.0 | \n",
+ " 0.0 | \n",
+ " 45.6 | \n",
+ " 42614.1456 | \n",
+ " 23747.96192 | \n",
+ " 0.038 | \n",
+ " 0.2400 | \n",
+ " 0.2780 | \n",
+ "
\n",
+ " \n",
+ " 5 | \n",
+ " 6.0 | \n",
+ " -530.630000 | \n",
+ " 1683.00000 | \n",
+ " 11000.0 | \n",
+ " 11000.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0000 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 530.630000 | \n",
+ " 11000.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0000 | \n",
+ " 1683.00000 | \n",
+ " 0.153 | \n",
+ " 0.0000 | \n",
+ " 0.1530 | \n",
+ "
\n",
+ " \n",
+ " 6 | \n",
+ " 7.0 | \n",
+ " -3402.289388 | \n",
+ " 5967.00000 | \n",
+ " 39000.0 | \n",
+ " 39250.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 20846.8 | \n",
+ " 2193.5232 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 1595.812588 | \n",
+ " 39250.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 2193.5232 | \n",
+ " 5967.00000 | \n",
+ " 0.153 | \n",
+ " 0.3306 | \n",
+ " 0.4836 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
7 rows × 22 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " ID Individual Income Tax Payroll Tax Wages AGI UI in AGI \\\n",
+ "0 1.0 23397.147200 21137.96192 160000.0 164500.0 0.0 \n",
+ "1 2.0 -5385.396064 7267.50000 47500.0 47800.0 0.0 \n",
+ "2 3.0 10049.408800 10710.00000 70000.0 80000.0 0.0 \n",
+ "3 4.0 7538.817600 18819.00000 123000.0 124200.0 0.0 \n",
+ "4 5.0 40659.745600 23747.96192 250000.0 251200.0 0.0 \n",
+ "5 6.0 -530.630000 1683.00000 11000.0 11000.0 0.0 \n",
+ "6 7.0 -3402.289388 5967.00000 39000.0 39250.0 0.0 \n",
+ "\n",
+ " OASDI in AGI Itemized Deductions Taxable Inc Regular Tax ... \\\n",
+ "0 0.0 0.0 146096.8 27397.1472 ... \n",
+ "1 0.0 0.0 23262.4 2365.9536 ... \n",
+ "2 0.0 0.0 67731.2 10049.4088 ... \n",
+ "3 0.0 0.0 99662.4 13538.8176 ... \n",
+ "4 0.0 0.0 226662.4 42614.1456 ... \n",
+ "5 0.0 0.0 0.0 0.0000 ... \n",
+ "6 0.0 0.0 20846.8 2193.5232 ... \n",
+ "\n",
+ " Child care credit EITC AMT Taxable Income AMT Liability \\\n",
+ "0 0.0 0.000000 164500.0 0.0 \n",
+ "1 0.0 1751.349664 47800.0 0.0 \n",
+ "2 0.0 0.000000 80000.0 0.0 \n",
+ "3 0.0 0.000000 124200.0 0.0 \n",
+ "4 0.0 0.000000 251200.0 0.0 \n",
+ "5 0.0 530.630000 11000.0 0.0 \n",
+ "6 0.0 1595.812588 39250.0 0.0 \n",
+ "\n",
+ " Net Investment Income Tax Income Tax Before Credits FICA \\\n",
+ "0 0.0 27397.1472 21137.96192 \n",
+ "1 0.0 2365.9536 7267.50000 \n",
+ "2 0.0 10049.4088 10710.00000 \n",
+ "3 0.0 13538.8176 18819.00000 \n",
+ "4 45.6 42614.1456 23747.96192 \n",
+ "5 0.0 0.0000 1683.00000 \n",
+ "6 0.0 2193.5232 5967.00000 \n",
+ "\n",
+ " Payroll Tax MTR Income Tax MTR Combined MTR \n",
+ "0 0.029 0.2400 0.2690 \n",
+ "1 0.153 0.3306 0.4836 \n",
+ "2 0.153 0.2200 0.3730 \n",
+ "3 0.153 0.2200 0.3730 \n",
+ "4 0.038 0.2400 0.2780 \n",
+ "5 0.153 0.0000 0.1530 \n",
+ "6 0.153 0.3306 0.4836 \n",
+ "\n",
+ "[7 rows x 22 columns]"
+ ]
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# outputs under current law (no reform)\n",
+ "b.create_table()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "CTC_c was redefined in release 1.0.0\n",
+ "\n",
+ "CTC_c was redefined in release 1.0.0\n",
+ "\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " ID | \n",
+ " Individual Income Tax | \n",
+ " Payroll Tax | \n",
+ " Wages | \n",
+ " AGI | \n",
+ " UI in AGI | \n",
+ " OASDI in AGI | \n",
+ " Itemized Deductions | \n",
+ " Taxable Inc | \n",
+ " Regular Tax | \n",
+ " ... | \n",
+ " Child care credit | \n",
+ " EITC | \n",
+ " AMT Taxable Income | \n",
+ " AMT Liability | \n",
+ " Net Investment Income Tax | \n",
+ " Income Tax Before Credits | \n",
+ " FICA | \n",
+ " Payroll Tax MTR | \n",
+ " Income Tax MTR | \n",
+ " Combined MTR | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 | \n",
+ " 1.0 | \n",
+ " 29979.889250 | \n",
+ " 21137.96192 | \n",
+ " 160000.0 | \n",
+ " 164500.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 141997.51 | \n",
+ " 29039.2814 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 164500.0 | \n",
+ " 940.60785 | \n",
+ " 0.0 | \n",
+ " 29979.88925 | \n",
+ " 21137.96192 | \n",
+ " 0.029 | \n",
+ " 0.3250 | \n",
+ " 0.3540 | \n",
+ "
\n",
+ " \n",
+ " 1 | \n",
+ " 2.0 | \n",
+ " -3521.399568 | \n",
+ " 7267.50000 | \n",
+ " 47500.0 | \n",
+ " 47800.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 13313.63 | \n",
+ " 1301.3630 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 1822.762568 | \n",
+ " 47800.0 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " 1301.36300 | \n",
+ " 7267.50000 | \n",
+ " 0.153 | \n",
+ " 0.3106 | \n",
+ " 0.4636 | \n",
+ "
\n",
+ " \n",
+ " 2 | \n",
+ " 3.0 | \n",
+ " 11818.824500 | \n",
+ " 10710.00000 | \n",
+ " 70000.0 | \n",
+ " 80000.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 69115.07 | \n",
+ " 11818.8245 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 80000.0 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " 11818.82450 | \n",
+ " 10710.00000 | \n",
+ " 0.153 | \n",
+ " 0.2500 | \n",
+ " 0.4030 | \n",
+ "
\n",
+ " \n",
+ " 3 | \n",
+ " 4.0 | \n",
+ " 11098.521000 | \n",
+ " 18819.00000 | \n",
+ " 123000.0 | \n",
+ " 124200.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 89713.63 | \n",
+ " 13388.5210 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 124200.0 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " 13388.52100 | \n",
+ " 18819.00000 | \n",
+ " 0.153 | \n",
+ " 0.3000 | \n",
+ " 0.4530 | \n",
+ "
\n",
+ " \n",
+ " 4 | \n",
+ " 5.0 | \n",
+ " 49216.118400 | \n",
+ " 23747.96192 | \n",
+ " 250000.0 | \n",
+ " 251200.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 225191.31 | \n",
+ " 49170.5184 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 251200.0 | \n",
+ " 0.00000 | \n",
+ " 45.6 | \n",
+ " 49170.51840 | \n",
+ " 23747.96192 | \n",
+ " 0.038 | \n",
+ " 0.2800 | \n",
+ " 0.3180 | \n",
+ "
\n",
+ " \n",
+ " 5 | \n",
+ " 6.0 | \n",
+ " -533.780000 | \n",
+ " 1683.00000 | \n",
+ " 11000.0 | \n",
+ " 11000.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.00 | \n",
+ " 0.0000 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 533.780000 | \n",
+ " 11000.0 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " 0.00000 | \n",
+ " 1683.00000 | \n",
+ " 0.153 | \n",
+ " 0.0000 | \n",
+ " 0.1530 | \n",
+ "
\n",
+ " \n",
+ " 6 | \n",
+ " 7.0 | \n",
+ " -1878.308196 | \n",
+ " 5967.00000 | \n",
+ " 39000.0 | \n",
+ " 39250.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 16747.51 | \n",
+ " 1776.0025 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 1654.310696 | \n",
+ " 39250.0 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " 1776.00250 | \n",
+ " 5967.00000 | \n",
+ " 0.153 | \n",
+ " 0.3606 | \n",
+ " 0.5136 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
7 rows × 22 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " ID Individual Income Tax Payroll Tax Wages AGI UI in AGI \\\n",
+ "0 1.0 29979.889250 21137.96192 160000.0 164500.0 0.0 \n",
+ "1 2.0 -3521.399568 7267.50000 47500.0 47800.0 0.0 \n",
+ "2 3.0 11818.824500 10710.00000 70000.0 80000.0 0.0 \n",
+ "3 4.0 11098.521000 18819.00000 123000.0 124200.0 0.0 \n",
+ "4 5.0 49216.118400 23747.96192 250000.0 251200.0 0.0 \n",
+ "5 6.0 -533.780000 1683.00000 11000.0 11000.0 0.0 \n",
+ "6 7.0 -1878.308196 5967.00000 39000.0 39250.0 0.0 \n",
+ "\n",
+ " OASDI in AGI Itemized Deductions Taxable Inc Regular Tax ... \\\n",
+ "0 0.0 0.0 141997.51 29039.2814 ... \n",
+ "1 0.0 0.0 13313.63 1301.3630 ... \n",
+ "2 0.0 0.0 69115.07 11818.8245 ... \n",
+ "3 0.0 0.0 89713.63 13388.5210 ... \n",
+ "4 0.0 0.0 225191.31 49170.5184 ... \n",
+ "5 0.0 0.0 0.00 0.0000 ... \n",
+ "6 0.0 0.0 16747.51 1776.0025 ... \n",
+ "\n",
+ " Child care credit EITC AMT Taxable Income AMT Liability \\\n",
+ "0 0.0 0.000000 164500.0 940.60785 \n",
+ "1 0.0 1822.762568 47800.0 0.00000 \n",
+ "2 0.0 0.000000 80000.0 0.00000 \n",
+ "3 0.0 0.000000 124200.0 0.00000 \n",
+ "4 0.0 0.000000 251200.0 0.00000 \n",
+ "5 0.0 533.780000 11000.0 0.00000 \n",
+ "6 0.0 1654.310696 39250.0 0.00000 \n",
+ "\n",
+ " Net Investment Income Tax Income Tax Before Credits FICA \\\n",
+ "0 0.0 29979.88925 21137.96192 \n",
+ "1 0.0 1301.36300 7267.50000 \n",
+ "2 0.0 11818.82450 10710.00000 \n",
+ "3 0.0 13388.52100 18819.00000 \n",
+ "4 45.6 49170.51840 23747.96192 \n",
+ "5 0.0 0.00000 1683.00000 \n",
+ "6 0.0 1776.00250 5967.00000 \n",
+ "\n",
+ " Payroll Tax MTR Income Tax MTR Combined MTR \n",
+ "0 0.029 0.3250 0.3540 \n",
+ "1 0.153 0.3106 0.4636 \n",
+ "2 0.153 0.2500 0.4030 \n",
+ "3 0.153 0.3000 0.4530 \n",
+ "4 0.038 0.2800 0.3180 \n",
+ "5 0.153 0.0000 0.1530 \n",
+ "6 0.153 0.3606 0.5136 \n",
+ "\n",
+ "[7 rows x 22 columns]"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# outputs under reform\n",
+ "b.create_table(reform_file='../taxcrunch/tests/test_reform.json')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "CTC_c was redefined in release 1.0.0\n",
+ "\n",
+ "CTC_c was redefined in release 1.0.0\n",
+ "\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " ID | \n",
+ " Individual Income Tax Diff | \n",
+ " Payroll Tax Diff | \n",
+ " Wages Diff | \n",
+ " AGI Diff | \n",
+ " UI in AGI Diff | \n",
+ " OASDI in AGI Diff | \n",
+ " Itemized Deductions Diff | \n",
+ " Taxable Inc Diff | \n",
+ " Regular Tax Diff | \n",
+ " ... | \n",
+ " Child care credit Diff | \n",
+ " EITC Diff | \n",
+ " AMT Taxable Income Diff | \n",
+ " AMT Liability Diff | \n",
+ " Net Investment Income Tax Diff | \n",
+ " Income Tax Before Credits Diff | \n",
+ " FICA Diff | \n",
+ " Payroll Tax MTR Diff | \n",
+ " Income Tax MTR Diff | \n",
+ " Combined MTR Diff | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 | \n",
+ " 1.0 | \n",
+ " 6582.742050 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " -4099.29 | \n",
+ " 1642.1342 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 0.0 | \n",
+ " 940.60785 | \n",
+ " 0.0 | \n",
+ " 2582.74205 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.085 | \n",
+ " 0.085 | \n",
+ "
\n",
+ " \n",
+ " 1 | \n",
+ " 2.0 | \n",
+ " 1863.996496 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " -9948.77 | \n",
+ " -1064.5906 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 71.412904 | \n",
+ " 0.0 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " -1064.59060 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " -0.020 | \n",
+ " -0.020 | \n",
+ "
\n",
+ " \n",
+ " 2 | \n",
+ " 3.0 | \n",
+ " 1769.415700 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 1383.87 | \n",
+ " 1769.4157 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 0.0 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " 1769.41570 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.030 | \n",
+ " 0.030 | \n",
+ "
\n",
+ " \n",
+ " 3 | \n",
+ " 4.0 | \n",
+ " 3559.703400 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " -9948.77 | \n",
+ " -150.2966 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 0.0 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " -150.29660 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.080 | \n",
+ " 0.080 | \n",
+ "
\n",
+ " \n",
+ " 4 | \n",
+ " 5.0 | \n",
+ " 8556.372800 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " -1471.09 | \n",
+ " 6556.3728 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 0.0 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " 6556.37280 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.040 | \n",
+ " 0.040 | \n",
+ "
\n",
+ " \n",
+ " 5 | \n",
+ " 6.0 | \n",
+ " -3.150000 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.00 | \n",
+ " 0.0000 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 3.150000 | \n",
+ " 0.0 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.000 | \n",
+ " 0.000 | \n",
+ "
\n",
+ " \n",
+ " 6 | \n",
+ " 7.0 | \n",
+ " 1523.981192 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " -4099.29 | \n",
+ " -417.5207 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 58.498108 | \n",
+ " 0.0 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " -417.52070 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.030 | \n",
+ " 0.030 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
7 rows × 22 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " ID Individual Income Tax Diff Payroll Tax Diff Wages Diff AGI Diff \\\n",
+ "0 1.0 6582.742050 0.0 0.0 0.0 \n",
+ "1 2.0 1863.996496 0.0 0.0 0.0 \n",
+ "2 3.0 1769.415700 0.0 0.0 0.0 \n",
+ "3 4.0 3559.703400 0.0 0.0 0.0 \n",
+ "4 5.0 8556.372800 0.0 0.0 0.0 \n",
+ "5 6.0 -3.150000 0.0 0.0 0.0 \n",
+ "6 7.0 1523.981192 0.0 0.0 0.0 \n",
+ "\n",
+ " UI in AGI Diff OASDI in AGI Diff Itemized Deductions Diff \\\n",
+ "0 0.0 0.0 0.0 \n",
+ "1 0.0 0.0 0.0 \n",
+ "2 0.0 0.0 0.0 \n",
+ "3 0.0 0.0 0.0 \n",
+ "4 0.0 0.0 0.0 \n",
+ "5 0.0 0.0 0.0 \n",
+ "6 0.0 0.0 0.0 \n",
+ "\n",
+ " Taxable Inc Diff Regular Tax Diff ... Child care credit Diff EITC Diff \\\n",
+ "0 -4099.29 1642.1342 ... 0.0 0.000000 \n",
+ "1 -9948.77 -1064.5906 ... 0.0 71.412904 \n",
+ "2 1383.87 1769.4157 ... 0.0 0.000000 \n",
+ "3 -9948.77 -150.2966 ... 0.0 0.000000 \n",
+ "4 -1471.09 6556.3728 ... 0.0 0.000000 \n",
+ "5 0.00 0.0000 ... 0.0 3.150000 \n",
+ "6 -4099.29 -417.5207 ... 0.0 58.498108 \n",
+ "\n",
+ " AMT Taxable Income Diff AMT Liability Diff \\\n",
+ "0 0.0 940.60785 \n",
+ "1 0.0 0.00000 \n",
+ "2 0.0 0.00000 \n",
+ "3 0.0 0.00000 \n",
+ "4 0.0 0.00000 \n",
+ "5 0.0 0.00000 \n",
+ "6 0.0 0.00000 \n",
+ "\n",
+ " Net Investment Income Tax Diff Income Tax Before Credits Diff FICA Diff \\\n",
+ "0 0.0 2582.74205 0.0 \n",
+ "1 0.0 -1064.59060 0.0 \n",
+ "2 0.0 1769.41570 0.0 \n",
+ "3 0.0 -150.29660 0.0 \n",
+ "4 0.0 6556.37280 0.0 \n",
+ "5 0.0 0.00000 0.0 \n",
+ "6 0.0 -417.52070 0.0 \n",
+ "\n",
+ " Payroll Tax MTR Diff Income Tax MTR Diff Combined MTR Diff \n",
+ "0 0.0 0.085 0.085 \n",
+ "1 0.0 -0.020 -0.020 \n",
+ "2 0.0 0.030 0.030 \n",
+ "3 0.0 0.080 0.080 \n",
+ "4 0.0 0.040 0.040 \n",
+ "5 0.0 0.000 0.000 \n",
+ "6 0.0 0.030 0.030 \n",
+ "\n",
+ "[7 rows x 22 columns]"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "b.create_diff_table(reform_file='../taxcrunch/tests/test_reform.json')"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Behavioral Responses\n",
+ "\n",
+ "Finally, the `Batch` class gives users the option to estimate behavioral responses to a tax policy reform. The three optional arguments for behavioral response analysis are:\n",
+ "\n",
+ "- `be_sub`: substitution elasticity of taxable income\n",
+ "- `be_inc`: income elasticity of taxable income\n",
+ "- `be_cg`: semi-elasticity of long-term capital gains\n",
+ "\n",
+ "The implementation of these elasticities is carried out by the [Behavioral-Responses](https://github.com/PSLmodels/Behavioral-Responses) project. Further discussion on the definition of the elasticities can be found [here](https://github.com/PSLmodels/Behavioral-Responses/blob/master/behresp/behavior.py)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "CTC_c was redefined in release 1.0.0\n",
+ "\n",
+ "CTC_c was redefined in release 1.0.0\n",
+ "\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " ID | \n",
+ " Individual Income Tax | \n",
+ " Payroll Tax | \n",
+ " Wages | \n",
+ " AGI | \n",
+ " UI in AGI | \n",
+ " OASDI in AGI | \n",
+ " Itemized Deductions | \n",
+ " Taxable Inc | \n",
+ " Regular Tax | \n",
+ " ... | \n",
+ " Child care credit | \n",
+ " EITC | \n",
+ " AMT Taxable Income | \n",
+ " AMT Liability | \n",
+ " Net Investment Income Tax | \n",
+ " Income Tax Before Credits | \n",
+ " FICA | \n",
+ " Payroll Tax MTR | \n",
+ " Income Tax MTR | \n",
+ " Combined MTR | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 | \n",
+ " 1.0 | \n",
+ " 28626.460638 | \n",
+ " 21020.498113 | \n",
+ " 155949.523912 | \n",
+ " 160335.604272 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 137833.114272 | \n",
+ " 27992.784568 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 160335.604272 | \n",
+ " 633.67607 | \n",
+ " 0.0 | \n",
+ " 28626.460638 | \n",
+ " 21020.498113 | \n",
+ " 0.029 | \n",
+ " 0.3250 | \n",
+ " 0.3540 | \n",
+ "
\n",
+ " \n",
+ " 1 | \n",
+ " 2.0 | \n",
+ " -3460.467696 | \n",
+ " 7297.326357 | \n",
+ " 47694.943511 | \n",
+ " 47996.174733 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 13509.804733 | \n",
+ " 1320.980473 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 1781.448169 | \n",
+ " 47996.174733 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " 1320.980473 | \n",
+ " 7297.326357 | \n",
+ " 0.153 | \n",
+ " 0.3106 | \n",
+ " 0.4636 | \n",
+ "
\n",
+ " \n",
+ " 2 | \n",
+ " 3.0 | \n",
+ " 11638.304246 | \n",
+ " 10613.331404 | \n",
+ " 69368.179113 | \n",
+ " 79277.918986 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 68392.988986 | \n",
+ " 11638.304246 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 79277.918986 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " 11638.304246 | \n",
+ " 10613.331404 | \n",
+ " 0.153 | \n",
+ " 0.2500 | \n",
+ " 0.4030 | \n",
+ "
\n",
+ " \n",
+ " 3 | \n",
+ " 4.0 | \n",
+ " 10248.521858 | \n",
+ " 18389.688839 | \n",
+ " 120194.044702 | \n",
+ " 121366.669528 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 86880.299528 | \n",
+ " 12680.188382 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 121366.669528 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " 12680.188382 | \n",
+ " 18389.688839 | \n",
+ " 0.153 | \n",
+ " 0.3000 | \n",
+ " 0.4530 | \n",
+ "
\n",
+ " \n",
+ " 4 | \n",
+ " 5.0 | \n",
+ " 48308.801171 | \n",
+ " 23659.138986 | \n",
+ " 246937.140197 | \n",
+ " 248122.438470 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 222113.748470 | \n",
+ " 48308.801171 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 248122.438470 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " 48308.801171 | \n",
+ " 23659.138986 | \n",
+ " 0.038 | \n",
+ " 0.2800 | \n",
+ " 0.3180 | \n",
+ "
\n",
+ " \n",
+ " 5 | \n",
+ " 6.0 | \n",
+ " -533.780000 | \n",
+ " 1683.000000 | \n",
+ " 11000.000000 | \n",
+ " 11000.000000 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 0.000000 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 533.780000 | \n",
+ " 11000.000000 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 1683.000000 | \n",
+ " 0.153 | \n",
+ " 0.0000 | \n",
+ " 0.1530 | \n",
+ "
\n",
+ " \n",
+ " 6 | \n",
+ " 7.0 | \n",
+ " -1973.400405 | \n",
+ " 5926.910043 | \n",
+ " 38737.974138 | \n",
+ " 38986.294485 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 16483.804485 | \n",
+ " 1736.446673 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 1709.847077 | \n",
+ " 38986.294485 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " 1736.446673 | \n",
+ " 5926.910043 | \n",
+ " 0.153 | \n",
+ " 0.3606 | \n",
+ " 0.5136 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
7 rows × 22 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " ID Individual Income Tax Payroll Tax Wages AGI \\\n",
+ "0 1.0 28626.460638 21020.498113 155949.523912 160335.604272 \n",
+ "1 2.0 -3460.467696 7297.326357 47694.943511 47996.174733 \n",
+ "2 3.0 11638.304246 10613.331404 69368.179113 79277.918986 \n",
+ "3 4.0 10248.521858 18389.688839 120194.044702 121366.669528 \n",
+ "4 5.0 48308.801171 23659.138986 246937.140197 248122.438470 \n",
+ "5 6.0 -533.780000 1683.000000 11000.000000 11000.000000 \n",
+ "6 7.0 -1973.400405 5926.910043 38737.974138 38986.294485 \n",
+ "\n",
+ " UI in AGI OASDI in AGI Itemized Deductions Taxable Inc Regular Tax \\\n",
+ "0 0.0 0.0 0.0 137833.114272 27992.784568 \n",
+ "1 0.0 0.0 0.0 13509.804733 1320.980473 \n",
+ "2 0.0 0.0 0.0 68392.988986 11638.304246 \n",
+ "3 0.0 0.0 0.0 86880.299528 12680.188382 \n",
+ "4 0.0 0.0 0.0 222113.748470 48308.801171 \n",
+ "5 0.0 0.0 0.0 0.000000 0.000000 \n",
+ "6 0.0 0.0 0.0 16483.804485 1736.446673 \n",
+ "\n",
+ " ... Child care credit EITC AMT Taxable Income AMT Liability \\\n",
+ "0 ... 0.0 0.000000 160335.604272 633.67607 \n",
+ "1 ... 0.0 1781.448169 47996.174733 0.00000 \n",
+ "2 ... 0.0 0.000000 79277.918986 0.00000 \n",
+ "3 ... 0.0 0.000000 121366.669528 0.00000 \n",
+ "4 ... 0.0 0.000000 248122.438470 0.00000 \n",
+ "5 ... 0.0 533.780000 11000.000000 0.00000 \n",
+ "6 ... 0.0 1709.847077 38986.294485 0.00000 \n",
+ "\n",
+ " Net Investment Income Tax Income Tax Before Credits FICA \\\n",
+ "0 0.0 28626.460638 21020.498113 \n",
+ "1 0.0 1320.980473 7297.326357 \n",
+ "2 0.0 11638.304246 10613.331404 \n",
+ "3 0.0 12680.188382 18389.688839 \n",
+ "4 0.0 48308.801171 23659.138986 \n",
+ "5 0.0 0.000000 1683.000000 \n",
+ "6 0.0 1736.446673 5926.910043 \n",
+ "\n",
+ " Payroll Tax MTR Income Tax MTR Combined MTR \n",
+ "0 0.029 0.3250 0.3540 \n",
+ "1 0.153 0.3106 0.4636 \n",
+ "2 0.153 0.2500 0.4030 \n",
+ "3 0.153 0.3000 0.4530 \n",
+ "4 0.038 0.2800 0.3180 \n",
+ "5 0.153 0.0000 0.1530 \n",
+ "6 0.153 0.3606 0.5136 \n",
+ "\n",
+ "[7 rows x 22 columns]"
+ ]
+ },
+ "execution_count": 8,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "b.create_table(reform_file='../taxcrunch/tests/test_reform.json', be_sub=0.25)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "CTC_c was redefined in release 1.0.0\n",
+ "\n",
+ "CTC_c was redefined in release 1.0.0\n",
+ "\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " ID | \n",
+ " Individual Income Tax Diff | \n",
+ " Payroll Tax Diff | \n",
+ " Wages Diff | \n",
+ " AGI Diff | \n",
+ " UI in AGI Diff | \n",
+ " OASDI in AGI Diff | \n",
+ " Itemized Deductions Diff | \n",
+ " Taxable Inc Diff | \n",
+ " Regular Tax Diff | \n",
+ " ... | \n",
+ " Child care credit Diff | \n",
+ " EITC Diff | \n",
+ " AMT Taxable Income Diff | \n",
+ " AMT Liability Diff | \n",
+ " Net Investment Income Tax Diff | \n",
+ " Income Tax Before Credits Diff | \n",
+ " FICA Diff | \n",
+ " Payroll Tax MTR Diff | \n",
+ " Income Tax MTR Diff | \n",
+ " Combined MTR Diff | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 | \n",
+ " 1.0 | \n",
+ " 5229.313438 | \n",
+ " -117.463807 | \n",
+ " -4050.476088 | \n",
+ " -4164.395728 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " -8263.685728 | \n",
+ " 595.637368 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " -4164.395728 | \n",
+ " 633.67607 | \n",
+ " 0.0 | \n",
+ " 1229.313438 | \n",
+ " -117.463807 | \n",
+ " 0.0 | \n",
+ " 0.085 | \n",
+ " 0.085 | \n",
+ "
\n",
+ " \n",
+ " 1 | \n",
+ " 2.0 | \n",
+ " 1924.928368 | \n",
+ " 29.826357 | \n",
+ " 194.943511 | \n",
+ " 196.174733 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " -9752.595267 | \n",
+ " -1044.973127 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 30.098505 | \n",
+ " 196.174733 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " -1044.973127 | \n",
+ " 29.826357 | \n",
+ " 0.0 | \n",
+ " -0.020 | \n",
+ " -0.020 | \n",
+ "
\n",
+ " \n",
+ " 2 | \n",
+ " 3.0 | \n",
+ " 1588.895446 | \n",
+ " -96.668596 | \n",
+ " -631.820887 | \n",
+ " -722.081014 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 661.788986 | \n",
+ " 1588.895446 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " -722.081014 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " 1588.895446 | \n",
+ " -96.668596 | \n",
+ " 0.0 | \n",
+ " 0.030 | \n",
+ " 0.030 | \n",
+ "
\n",
+ " \n",
+ " 3 | \n",
+ " 4.0 | \n",
+ " 2709.704258 | \n",
+ " -429.311161 | \n",
+ " -2805.955298 | \n",
+ " -2833.330472 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " -12782.100472 | \n",
+ " -858.629218 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " -2833.330472 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " -858.629218 | \n",
+ " -429.311161 | \n",
+ " 0.0 | \n",
+ " 0.080 | \n",
+ " 0.080 | \n",
+ "
\n",
+ " \n",
+ " 4 | \n",
+ " 5.0 | \n",
+ " 7649.055571 | \n",
+ " -88.822934 | \n",
+ " -3062.859803 | \n",
+ " -3077.561530 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " -4548.651530 | \n",
+ " 5694.655571 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " -3077.561530 | \n",
+ " 0.00000 | \n",
+ " -45.6 | \n",
+ " 5694.655571 | \n",
+ " -88.822934 | \n",
+ " 0.0 | \n",
+ " 0.040 | \n",
+ " 0.040 | \n",
+ "
\n",
+ " \n",
+ " 5 | \n",
+ " 6.0 | \n",
+ " -3.150000 | \n",
+ " 0.000000 | \n",
+ " 0.000000 | \n",
+ " 0.000000 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 0.000000 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 3.150000 | \n",
+ " 0.000000 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " 0.000000 | \n",
+ " 0.000000 | \n",
+ " 0.0 | \n",
+ " 0.000 | \n",
+ " 0.000 | \n",
+ "
\n",
+ " \n",
+ " 6 | \n",
+ " 7.0 | \n",
+ " 1428.888983 | \n",
+ " -40.089957 | \n",
+ " -262.025862 | \n",
+ " -263.705515 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " -4362.995515 | \n",
+ " -457.076527 | \n",
+ " ... | \n",
+ " 0.0 | \n",
+ " 114.034489 | \n",
+ " -263.705515 | \n",
+ " 0.00000 | \n",
+ " 0.0 | \n",
+ " -457.076527 | \n",
+ " -40.089957 | \n",
+ " 0.0 | \n",
+ " 0.030 | \n",
+ " 0.030 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
7 rows × 22 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " ID Individual Income Tax Diff Payroll Tax Diff Wages Diff \\\n",
+ "0 1.0 5229.313438 -117.463807 -4050.476088 \n",
+ "1 2.0 1924.928368 29.826357 194.943511 \n",
+ "2 3.0 1588.895446 -96.668596 -631.820887 \n",
+ "3 4.0 2709.704258 -429.311161 -2805.955298 \n",
+ "4 5.0 7649.055571 -88.822934 -3062.859803 \n",
+ "5 6.0 -3.150000 0.000000 0.000000 \n",
+ "6 7.0 1428.888983 -40.089957 -262.025862 \n",
+ "\n",
+ " AGI Diff UI in AGI Diff OASDI in AGI Diff Itemized Deductions Diff \\\n",
+ "0 -4164.395728 0.0 0.0 0.0 \n",
+ "1 196.174733 0.0 0.0 0.0 \n",
+ "2 -722.081014 0.0 0.0 0.0 \n",
+ "3 -2833.330472 0.0 0.0 0.0 \n",
+ "4 -3077.561530 0.0 0.0 0.0 \n",
+ "5 0.000000 0.0 0.0 0.0 \n",
+ "6 -263.705515 0.0 0.0 0.0 \n",
+ "\n",
+ " Taxable Inc Diff Regular Tax Diff ... Child care credit Diff \\\n",
+ "0 -8263.685728 595.637368 ... 0.0 \n",
+ "1 -9752.595267 -1044.973127 ... 0.0 \n",
+ "2 661.788986 1588.895446 ... 0.0 \n",
+ "3 -12782.100472 -858.629218 ... 0.0 \n",
+ "4 -4548.651530 5694.655571 ... 0.0 \n",
+ "5 0.000000 0.000000 ... 0.0 \n",
+ "6 -4362.995515 -457.076527 ... 0.0 \n",
+ "\n",
+ " EITC Diff AMT Taxable Income Diff AMT Liability Diff \\\n",
+ "0 0.000000 -4164.395728 633.67607 \n",
+ "1 30.098505 196.174733 0.00000 \n",
+ "2 0.000000 -722.081014 0.00000 \n",
+ "3 0.000000 -2833.330472 0.00000 \n",
+ "4 0.000000 -3077.561530 0.00000 \n",
+ "5 3.150000 0.000000 0.00000 \n",
+ "6 114.034489 -263.705515 0.00000 \n",
+ "\n",
+ " Net Investment Income Tax Diff Income Tax Before Credits Diff FICA Diff \\\n",
+ "0 0.0 1229.313438 -117.463807 \n",
+ "1 0.0 -1044.973127 29.826357 \n",
+ "2 0.0 1588.895446 -96.668596 \n",
+ "3 0.0 -858.629218 -429.311161 \n",
+ "4 -45.6 5694.655571 -88.822934 \n",
+ "5 0.0 0.000000 0.000000 \n",
+ "6 0.0 -457.076527 -40.089957 \n",
+ "\n",
+ " Payroll Tax MTR Diff Income Tax MTR Diff Combined MTR Diff \n",
+ "0 0.0 0.085 0.085 \n",
+ "1 0.0 -0.020 -0.020 \n",
+ "2 0.0 0.030 0.030 \n",
+ "3 0.0 0.080 0.080 \n",
+ "4 0.0 0.040 0.040 \n",
+ "5 0.0 0.000 0.000 \n",
+ "6 0.0 0.030 0.030 \n",
+ "\n",
+ "[7 rows x 22 columns]"
+ ]
+ },
+ "execution_count": 9,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "b.create_diff_table(reform_file='../taxcrunch/tests/test_reform.json', be_sub=0.25)"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.7.3"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/docs/example_adjustment.json b/docs/example_adjustment.json
deleted file mode 100644
index 8df4faa..0000000
--- a/docs/example_adjustment.json
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "mstat": [
- {"value": "Joint"}
- ],
- "page": [
- {"value": 60}
- ],
- "sage": [
- {"value": 55}
- ],
- "depx": [
- {"value": 2}
- ],
- "dep13": [
- {"value": 0}
- ],
- "dep17": [
- {"value": 2}
- ],
- "dep18": [
- {"value": 2}
- ],
- "pwages": [
- {"value": 40000}
- ],
- "swages": [
- {"value": 30000}
- ],
- "stcg": [
- {"value": 1000}
- ],
- "pensions": [
- {"value": 10000}
- ],
- "reform_options": [
- {"value": "2017_law.json"}
- ]
-}
\ No newline at end of file
diff --git a/docs/example_multi.ipynb b/docs/example_multi.ipynb
deleted file mode 100644
index 58d8f76..0000000
--- a/docs/example_multi.ipynb
+++ /dev/null
@@ -1,1194 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "outputs": [],
- "source": [
- "from taxcrunch.multi_cruncher import Batch"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 2,
- "metadata": {},
- "outputs": [],
- "source": [
- "#specify path to input csv file\n",
- "path = 'example_input.csv'\n",
- "#initiate Batch class\n",
- "b = Batch(path)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 3,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " ID | \n",
- " Individual Income Tax | \n",
- " Payroll Tax | \n",
- " Wages | \n",
- " AGI | \n",
- " UI in AGI | \n",
- " OASDI in AGI | \n",
- " Itemized Deductions | \n",
- " Taxable Inc | \n",
- " Regular Tax | \n",
- " ... | \n",
- " Child care credit | \n",
- " EITC | \n",
- " AMT Taxable Income | \n",
- " AMT Liability | \n",
- " Net Investment Income Tax | \n",
- " Income Tax Before Credits | \n",
- " FICA | \n",
- " Payroll Tax MTR | \n",
- " Income Tax MTR | \n",
- " Combined MTR | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " 1.0 | \n",
- " 23397.147200 | \n",
- " 21137.96192 | \n",
- " 160000.0 | \n",
- " 164500.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 146096.8 | \n",
- " 27397.1472 | \n",
- " ... | \n",
- " 0.0 | \n",
- " 0.000000 | \n",
- " 164500.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 27397.1472 | \n",
- " 21137.96192 | \n",
- " 0.029 | \n",
- " 0.2400 | \n",
- " 0.2690 | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " 2.0 | \n",
- " -5385.396064 | \n",
- " 7267.50000 | \n",
- " 47500.0 | \n",
- " 47800.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 23262.4 | \n",
- " 2365.9536 | \n",
- " ... | \n",
- " 0.0 | \n",
- " 1751.349664 | \n",
- " 47800.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 2365.9536 | \n",
- " 7267.50000 | \n",
- " 0.153 | \n",
- " 0.3306 | \n",
- " 0.4836 | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " 3.0 | \n",
- " 10049.408800 | \n",
- " 10710.00000 | \n",
- " 70000.0 | \n",
- " 80000.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 67731.2 | \n",
- " 10049.4088 | \n",
- " ... | \n",
- " 0.0 | \n",
- " 0.000000 | \n",
- " 80000.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 10049.4088 | \n",
- " 10710.00000 | \n",
- " 0.153 | \n",
- " 0.2200 | \n",
- " 0.3730 | \n",
- "
\n",
- " \n",
- " 3 | \n",
- " 4.0 | \n",
- " 6538.817600 | \n",
- " 18819.00000 | \n",
- " 123000.0 | \n",
- " 124200.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 99662.4 | \n",
- " 13538.8176 | \n",
- " ... | \n",
- " 0.0 | \n",
- " 0.000000 | \n",
- " 124200.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 13538.8176 | \n",
- " 18819.00000 | \n",
- " 0.153 | \n",
- " 0.2200 | \n",
- " 0.3730 | \n",
- "
\n",
- " \n",
- " 4 | \n",
- " 5.0 | \n",
- " 40659.745600 | \n",
- " 23747.96192 | \n",
- " 250000.0 | \n",
- " 251200.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 226662.4 | \n",
- " 42614.1456 | \n",
- " ... | \n",
- " 0.0 | \n",
- " 0.000000 | \n",
- " 251200.0 | \n",
- " 0.0 | \n",
- " 45.6 | \n",
- " 42614.1456 | \n",
- " 23747.96192 | \n",
- " 0.038 | \n",
- " 0.2400 | \n",
- " 0.2780 | \n",
- "
\n",
- " \n",
- " 5 | \n",
- " 6.0 | \n",
- " -530.630000 | \n",
- " 1683.00000 | \n",
- " 11000.0 | \n",
- " 11000.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0000 | \n",
- " ... | \n",
- " 0.0 | \n",
- " 530.630000 | \n",
- " 11000.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0000 | \n",
- " 1683.00000 | \n",
- " 0.153 | \n",
- " 0.0000 | \n",
- " 0.1530 | \n",
- "
\n",
- " \n",
- " 6 | \n",
- " 7.0 | \n",
- " -3402.289388 | \n",
- " 5967.00000 | \n",
- " 39000.0 | \n",
- " 39250.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 20846.8 | \n",
- " 2193.5232 | \n",
- " ... | \n",
- " 0.0 | \n",
- " 1595.812588 | \n",
- " 39250.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 2193.5232 | \n",
- " 5967.00000 | \n",
- " 0.153 | \n",
- " 0.3306 | \n",
- " 0.4836 | \n",
- "
\n",
- " \n",
- "
\n",
- "
7 rows × 22 columns
\n",
- "
"
- ],
- "text/plain": [
- " ID Individual Income Tax Payroll Tax Wages AGI UI in AGI \\\n",
- "0 1.0 23397.147200 21137.96192 160000.0 164500.0 0.0 \n",
- "1 2.0 -5385.396064 7267.50000 47500.0 47800.0 0.0 \n",
- "2 3.0 10049.408800 10710.00000 70000.0 80000.0 0.0 \n",
- "3 4.0 6538.817600 18819.00000 123000.0 124200.0 0.0 \n",
- "4 5.0 40659.745600 23747.96192 250000.0 251200.0 0.0 \n",
- "5 6.0 -530.630000 1683.00000 11000.0 11000.0 0.0 \n",
- "6 7.0 -3402.289388 5967.00000 39000.0 39250.0 0.0 \n",
- "\n",
- " OASDI in AGI Itemized Deductions Taxable Inc Regular Tax ... \\\n",
- "0 0.0 0.0 146096.8 27397.1472 ... \n",
- "1 0.0 0.0 23262.4 2365.9536 ... \n",
- "2 0.0 0.0 67731.2 10049.4088 ... \n",
- "3 0.0 0.0 99662.4 13538.8176 ... \n",
- "4 0.0 0.0 226662.4 42614.1456 ... \n",
- "5 0.0 0.0 0.0 0.0000 ... \n",
- "6 0.0 0.0 20846.8 2193.5232 ... \n",
- "\n",
- " Child care credit EITC AMT Taxable Income AMT Liability \\\n",
- "0 0.0 0.000000 164500.0 0.0 \n",
- "1 0.0 1751.349664 47800.0 0.0 \n",
- "2 0.0 0.000000 80000.0 0.0 \n",
- "3 0.0 0.000000 124200.0 0.0 \n",
- "4 0.0 0.000000 251200.0 0.0 \n",
- "5 0.0 530.630000 11000.0 0.0 \n",
- "6 0.0 1595.812588 39250.0 0.0 \n",
- "\n",
- " Net Investment Income Tax Income Tax Before Credits FICA \\\n",
- "0 0.0 27397.1472 21137.96192 \n",
- "1 0.0 2365.9536 7267.50000 \n",
- "2 0.0 10049.4088 10710.00000 \n",
- "3 0.0 13538.8176 18819.00000 \n",
- "4 45.6 42614.1456 23747.96192 \n",
- "5 0.0 0.0000 1683.00000 \n",
- "6 0.0 2193.5232 5967.00000 \n",
- "\n",
- " Payroll Tax MTR Income Tax MTR Combined MTR \n",
- "0 0.029 0.2400 0.2690 \n",
- "1 0.153 0.3306 0.4836 \n",
- "2 0.153 0.2200 0.3730 \n",
- "3 0.153 0.2200 0.3730 \n",
- "4 0.038 0.2400 0.2780 \n",
- "5 0.153 0.0000 0.1530 \n",
- "6 0.153 0.3306 0.4836 \n",
- "\n",
- "[7 rows x 22 columns]"
- ]
- },
- "execution_count": 3,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# outputs under current law (no reform)\n",
- "b.create_table()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 4,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "CTC_c was redefined in release 1.0.0\n",
- "\n"
- ]
- },
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " ID | \n",
- " Individual Income Tax | \n",
- " Payroll Tax | \n",
- " Wages | \n",
- " AGI | \n",
- " UI in AGI | \n",
- " OASDI in AGI | \n",
- " Itemized Deductions | \n",
- " Taxable Inc | \n",
- " Regular Tax | \n",
- " ... | \n",
- " Child care credit | \n",
- " EITC | \n",
- " AMT Taxable Income | \n",
- " AMT Liability | \n",
- " Net Investment Income Tax | \n",
- " Income Tax Before Credits | \n",
- " FICA | \n",
- " Payroll Tax MTR | \n",
- " Income Tax MTR | \n",
- " Combined MTR | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " 1.0 | \n",
- " 29979.889250 | \n",
- " 21137.96192 | \n",
- " 160000.0 | \n",
- " 164500.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 141997.51 | \n",
- " 29039.2814 | \n",
- " ... | \n",
- " 0.0 | \n",
- " 0.000000 | \n",
- " 164500.0 | \n",
- " 940.60785 | \n",
- " 0.0 | \n",
- " 29979.88925 | \n",
- " 21137.96192 | \n",
- " 0.029 | \n",
- " 0.3250 | \n",
- " 0.3540 | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " 2.0 | \n",
- " -3521.399568 | \n",
- " 7267.50000 | \n",
- " 47500.0 | \n",
- " 47800.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 13313.63 | \n",
- " 1301.3630 | \n",
- " ... | \n",
- " 0.0 | \n",
- " 1822.762568 | \n",
- " 47800.0 | \n",
- " 0.00000 | \n",
- " 0.0 | \n",
- " 1301.36300 | \n",
- " 7267.50000 | \n",
- " 0.153 | \n",
- " 0.3106 | \n",
- " 0.4636 | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " 3.0 | \n",
- " 11818.824500 | \n",
- " 10710.00000 | \n",
- " 70000.0 | \n",
- " 80000.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 69115.07 | \n",
- " 11818.8245 | \n",
- " ... | \n",
- " 0.0 | \n",
- " 0.000000 | \n",
- " 80000.0 | \n",
- " 0.00000 | \n",
- " 0.0 | \n",
- " 11818.82450 | \n",
- " 10710.00000 | \n",
- " 0.153 | \n",
- " 0.2500 | \n",
- " 0.4030 | \n",
- "
\n",
- " \n",
- " 3 | \n",
- " 4.0 | \n",
- " 8979.101000 | \n",
- " 18819.00000 | \n",
- " 123000.0 | \n",
- " 124200.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 81235.95 | \n",
- " 11269.1010 | \n",
- " ... | \n",
- " 0.0 | \n",
- " 0.000000 | \n",
- " 124200.0 | \n",
- " 0.00000 | \n",
- " 0.0 | \n",
- " 11269.10100 | \n",
- " 18819.00000 | \n",
- " 0.153 | \n",
- " 0.3000 | \n",
- " 0.4530 | \n",
- "
\n",
- " \n",
- " 4 | \n",
- " 5.0 | \n",
- " 49216.118400 | \n",
- " 23747.96192 | \n",
- " 250000.0 | \n",
- " 251200.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 225191.31 | \n",
- " 49170.5184 | \n",
- " ... | \n",
- " 0.0 | \n",
- " 0.000000 | \n",
- " 251200.0 | \n",
- " 0.00000 | \n",
- " 45.6 | \n",
- " 49170.51840 | \n",
- " 23747.96192 | \n",
- " 0.038 | \n",
- " 0.2800 | \n",
- " 0.3180 | \n",
- "
\n",
- " \n",
- " 5 | \n",
- " 6.0 | \n",
- " -533.780000 | \n",
- " 1683.00000 | \n",
- " 11000.0 | \n",
- " 11000.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.00 | \n",
- " 0.0000 | \n",
- " ... | \n",
- " 0.0 | \n",
- " 533.780000 | \n",
- " 11000.0 | \n",
- " 0.00000 | \n",
- " 0.0 | \n",
- " 0.00000 | \n",
- " 1683.00000 | \n",
- " 0.153 | \n",
- " 0.0000 | \n",
- " 0.1530 | \n",
- "
\n",
- " \n",
- " 6 | \n",
- " 7.0 | \n",
- " -1878.308196 | \n",
- " 5967.00000 | \n",
- " 39000.0 | \n",
- " 39250.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 16747.51 | \n",
- " 1776.0025 | \n",
- " ... | \n",
- " 0.0 | \n",
- " 1654.310696 | \n",
- " 39250.0 | \n",
- " 0.00000 | \n",
- " 0.0 | \n",
- " 1776.00250 | \n",
- " 5967.00000 | \n",
- " 0.153 | \n",
- " 0.3606 | \n",
- " 0.5136 | \n",
- "
\n",
- " \n",
- "
\n",
- "
7 rows × 22 columns
\n",
- "
"
- ],
- "text/plain": [
- " ID Individual Income Tax Payroll Tax Wages AGI UI in AGI \\\n",
- "0 1.0 29979.889250 21137.96192 160000.0 164500.0 0.0 \n",
- "1 2.0 -3521.399568 7267.50000 47500.0 47800.0 0.0 \n",
- "2 3.0 11818.824500 10710.00000 70000.0 80000.0 0.0 \n",
- "3 4.0 8979.101000 18819.00000 123000.0 124200.0 0.0 \n",
- "4 5.0 49216.118400 23747.96192 250000.0 251200.0 0.0 \n",
- "5 6.0 -533.780000 1683.00000 11000.0 11000.0 0.0 \n",
- "6 7.0 -1878.308196 5967.00000 39000.0 39250.0 0.0 \n",
- "\n",
- " OASDI in AGI Itemized Deductions Taxable Inc Regular Tax ... \\\n",
- "0 0.0 0.0 141997.51 29039.2814 ... \n",
- "1 0.0 0.0 13313.63 1301.3630 ... \n",
- "2 0.0 0.0 69115.07 11818.8245 ... \n",
- "3 0.0 0.0 81235.95 11269.1010 ... \n",
- "4 0.0 0.0 225191.31 49170.5184 ... \n",
- "5 0.0 0.0 0.00 0.0000 ... \n",
- "6 0.0 0.0 16747.51 1776.0025 ... \n",
- "\n",
- " Child care credit EITC AMT Taxable Income AMT Liability \\\n",
- "0 0.0 0.000000 164500.0 940.60785 \n",
- "1 0.0 1822.762568 47800.0 0.00000 \n",
- "2 0.0 0.000000 80000.0 0.00000 \n",
- "3 0.0 0.000000 124200.0 0.00000 \n",
- "4 0.0 0.000000 251200.0 0.00000 \n",
- "5 0.0 533.780000 11000.0 0.00000 \n",
- "6 0.0 1654.310696 39250.0 0.00000 \n",
- "\n",
- " Net Investment Income Tax Income Tax Before Credits FICA \\\n",
- "0 0.0 29979.88925 21137.96192 \n",
- "1 0.0 1301.36300 7267.50000 \n",
- "2 0.0 11818.82450 10710.00000 \n",
- "3 0.0 11269.10100 18819.00000 \n",
- "4 45.6 49170.51840 23747.96192 \n",
- "5 0.0 0.00000 1683.00000 \n",
- "6 0.0 1776.00250 5967.00000 \n",
- "\n",
- " Payroll Tax MTR Income Tax MTR Combined MTR \n",
- "0 0.029 0.3250 0.3540 \n",
- "1 0.153 0.3106 0.4636 \n",
- "2 0.153 0.2500 0.4030 \n",
- "3 0.153 0.3000 0.4530 \n",
- "4 0.038 0.2800 0.3180 \n",
- "5 0.153 0.0000 0.1530 \n",
- "6 0.153 0.3606 0.5136 \n",
- "\n",
- "[7 rows x 22 columns]"
- ]
- },
- "execution_count": 4,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# outputs under local reform\n",
- "b.create_table('../taxcrunch/tests/test_reform.json')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 5,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "CTC_c was redefined in release 1.0.0\n",
- "\n"
- ]
- },
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " ID | \n",
- " Individual Income Tax | \n",
- " Payroll Tax | \n",
- " Wages | \n",
- " AGI | \n",
- " UI in AGI | \n",
- " OASDI in AGI | \n",
- " Itemized Deductions | \n",
- " Taxable Inc | \n",
- " Regular Tax | \n",
- " ... | \n",
- " CTC Refundable | \n",
- " Child care credit | \n",
- " EITC | \n",
- " AMT | \n",
- " Net Investment Income Tax | \n",
- " Income Tax Before Credits | \n",
- " FICA | \n",
- " Payroll Tax MTR | \n",
- " Income Tax MTR | \n",
- " Combined MTR | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " 1.0 | \n",
- " 23797.147200 | \n",
- " 21137.96192 | \n",
- " 160000.0 | \n",
- " 164500.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 146096.8 | \n",
- " 27802.1472 | \n",
- " ... | \n",
- " 0.0000 | \n",
- " 0.0 | \n",
- " 0.000000 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 27397.1472 | \n",
- " 21137.96192 | \n",
- " 0.029 | \n",
- " 0.2400 | \n",
- " 0.2690 | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " 2.0 | \n",
- " -4785.396064 | \n",
- " 7267.50000 | \n",
- " 47500.0 | \n",
- " 47800.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 23262.4 | \n",
- " 2401.9536 | \n",
- " ... | \n",
- " 3034.0464 | \n",
- " 0.0 | \n",
- " 1751.349664 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 2365.9536 | \n",
- " 7267.50000 | \n",
- " 0.153 | \n",
- " 0.3306 | \n",
- " 0.4836 | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " 3.0 | \n",
- " 10049.408800 | \n",
- " 10710.00000 | \n",
- " 70000.0 | \n",
- " 80000.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 67731.2 | \n",
- " 10749.4088 | \n",
- " ... | \n",
- " 0.0000 | \n",
- " 0.0 | \n",
- " 0.000000 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 10049.4088 | \n",
- " 10710.00000 | \n",
- " 0.153 | \n",
- " 0.2200 | \n",
- " 0.3730 | \n",
- "
\n",
- " \n",
- " 3 | \n",
- " 4.0 | \n",
- " 7138.817600 | \n",
- " 18819.00000 | \n",
- " 123000.0 | \n",
- " 124200.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 99662.4 | \n",
- " 13622.8176 | \n",
- " ... | \n",
- " 0.0000 | \n",
- " 0.0 | \n",
- " 0.000000 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 13538.8176 | \n",
- " 18819.00000 | \n",
- " 0.153 | \n",
- " 0.2200 | \n",
- " 0.3730 | \n",
- "
\n",
- " \n",
- " 4 | \n",
- " 5.0 | \n",
- " 40859.745600 | \n",
- " 23747.96192 | \n",
- " 250000.0 | \n",
- " 251200.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 226662.4 | \n",
- " 42722.1456 | \n",
- " ... | \n",
- " 0.0000 | \n",
- " 0.0 | \n",
- " 0.000000 | \n",
- " 0.0 | \n",
- " 45.6 | \n",
- " 42614.1456 | \n",
- " 23747.96192 | \n",
- " 0.038 | \n",
- " 0.2400 | \n",
- " 0.2780 | \n",
- "
\n",
- " \n",
- " 5 | \n",
- " 6.0 | \n",
- " -530.630000 | \n",
- " 1683.00000 | \n",
- " 11000.0 | \n",
- " 11000.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0000 | \n",
- " ... | \n",
- " 0.0000 | \n",
- " 0.0 | \n",
- " 530.630000 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0000 | \n",
- " 1683.00000 | \n",
- " 0.153 | \n",
- " 0.0000 | \n",
- " 0.1530 | \n",
- "
\n",
- " \n",
- " 6 | \n",
- " 7.0 | \n",
- " -3002.289388 | \n",
- " 5967.00000 | \n",
- " 39000.0 | \n",
- " 39250.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 20846.8 | \n",
- " 2223.5232 | \n",
- " ... | \n",
- " 1406.4768 | \n",
- " 0.0 | \n",
- " 1595.812588 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 2193.5232 | \n",
- " 5967.00000 | \n",
- " 0.153 | \n",
- " 0.3306 | \n",
- " 0.4836 | \n",
- "
\n",
- " \n",
- "
\n",
- "
7 rows × 21 columns
\n",
- "
"
- ],
- "text/plain": [
- " ID Individual Income Tax Payroll Tax Wages AGI UI in AGI \\\n",
- "0 1.0 23797.147200 21137.96192 160000.0 164500.0 0.0 \n",
- "1 2.0 -4785.396064 7267.50000 47500.0 47800.0 0.0 \n",
- "2 3.0 10049.408800 10710.00000 70000.0 80000.0 0.0 \n",
- "3 4.0 7138.817600 18819.00000 123000.0 124200.0 0.0 \n",
- "4 5.0 40859.745600 23747.96192 250000.0 251200.0 0.0 \n",
- "5 6.0 -530.630000 1683.00000 11000.0 11000.0 0.0 \n",
- "6 7.0 -3002.289388 5967.00000 39000.0 39250.0 0.0 \n",
- "\n",
- " OASDI in AGI Itemized Deductions Taxable Inc Regular Tax ... \\\n",
- "0 0.0 0.0 146096.8 27802.1472 ... \n",
- "1 0.0 0.0 23262.4 2401.9536 ... \n",
- "2 0.0 0.0 67731.2 10749.4088 ... \n",
- "3 0.0 0.0 99662.4 13622.8176 ... \n",
- "4 0.0 0.0 226662.4 42722.1456 ... \n",
- "5 0.0 0.0 0.0 0.0000 ... \n",
- "6 0.0 0.0 20846.8 2223.5232 ... \n",
- "\n",
- " CTC Refundable Child care credit EITC AMT \\\n",
- "0 0.0000 0.0 0.000000 0.0 \n",
- "1 3034.0464 0.0 1751.349664 0.0 \n",
- "2 0.0000 0.0 0.000000 0.0 \n",
- "3 0.0000 0.0 0.000000 0.0 \n",
- "4 0.0000 0.0 0.000000 0.0 \n",
- "5 0.0000 0.0 530.630000 0.0 \n",
- "6 1406.4768 0.0 1595.812588 0.0 \n",
- "\n",
- " Net Investment Income Tax Income Tax Before Credits FICA \\\n",
- "0 0.0 27397.1472 21137.96192 \n",
- "1 0.0 2365.9536 7267.50000 \n",
- "2 0.0 10049.4088 10710.00000 \n",
- "3 0.0 13538.8176 18819.00000 \n",
- "4 45.6 42614.1456 23747.96192 \n",
- "5 0.0 0.0000 1683.00000 \n",
- "6 0.0 2193.5232 5967.00000 \n",
- "\n",
- " Payroll Tax MTR Income Tax MTR Combined MTR \n",
- "0 0.029 0.2400 0.2690 \n",
- "1 0.153 0.3306 0.4836 \n",
- "2 0.153 0.2200 0.3730 \n",
- "3 0.153 0.2200 0.3730 \n",
- "4 0.038 0.2400 0.2780 \n",
- "5 0.153 0.0000 0.1530 \n",
- "6 0.153 0.3306 0.4836 \n",
- "\n",
- "[7 rows x 21 columns]"
- ]
- },
- "execution_count": 5,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# outputs under dictionary reform\n",
- "reform_dict = {\n",
- " \"CTC_c\": {2013: 1300, 2018: 1800}\n",
- " }\n",
- "\n",
- "b.create_table(reform_dict)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 6,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " ID | \n",
- " Individual Income Tax | \n",
- " Payroll Tax | \n",
- " Wages | \n",
- " AGI | \n",
- " UI in AGI | \n",
- " OASDI in AGI | \n",
- " Itemized Deductions | \n",
- " Taxable Inc | \n",
- " Regular Tax | \n",
- " ... | \n",
- " CTC Refundable | \n",
- " Child care credit | \n",
- " EITC | \n",
- " AMT | \n",
- " Net Investment Income Tax | \n",
- " Income Tax Before Credits | \n",
- " FICA | \n",
- " Payroll Tax MTR | \n",
- " Income Tax MTR | \n",
- " Combined MTR | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " 1.0 | \n",
- " 21502.221500 | \n",
- " 21137.96192 | \n",
- " 160000.0 | \n",
- " 164500.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 133254.45 | \n",
- " 25502.2215 | \n",
- " ... | \n",
- " 0.00 | \n",
- " 0.0 | \n",
- " 0.000000 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 25502.2215 | \n",
- " 21137.96192 | \n",
- " 0.029 | \n",
- " 0.2500 | \n",
- " 0.2790 | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " 2.0 | \n",
- " -8588.529664 | \n",
- " 7267.50000 | \n",
- " 47500.0 | \n",
- " 47800.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.00 | \n",
- " 0.0000 | \n",
- " ... | \n",
- " 4200.00 | \n",
- " 0.0 | \n",
- " 4388.529664 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0000 | \n",
- " 7267.50000 | \n",
- " 0.153 | \n",
- " 0.2106 | \n",
- " 0.3636 | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " 3.0 | \n",
- " 6981.016500 | \n",
- " 10710.00000 | \n",
- " 70000.0 | \n",
- " 80000.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 59169.63 | \n",
- " 6981.0165 | \n",
- " ... | \n",
- " 0.00 | \n",
- " 0.0 | \n",
- " 0.000000 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 6981.0165 | \n",
- " 10710.00000 | \n",
- " 0.153 | \n",
- " 0.2500 | \n",
- " 0.4030 | \n",
- "
\n",
- " \n",
- " 3 | \n",
- " 4.0 | \n",
- " -1349.870000 | \n",
- " 18819.00000 | \n",
- " 123000.0 | \n",
- " 124200.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 56501.30 | \n",
- " 5650.1300 | \n",
- " ... | \n",
- " 1349.87 | \n",
- " 0.0 | \n",
- " 0.000000 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 5650.1300 | \n",
- " 18819.00000 | \n",
- " 0.153 | \n",
- " 0.1000 | \n",
- " 0.2530 | \n",
- "
\n",
- " \n",
- " 4 | \n",
- " 5.0 | \n",
- " 33505.731500 | \n",
- " 23747.96192 | \n",
- " 250000.0 | \n",
- " 251200.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 204331.66 | \n",
- " 35460.1315 | \n",
- " ... | \n",
- " 0.00 | \n",
- " 0.0 | \n",
- " 0.000000 | \n",
- " 0.0 | \n",
- " 45.6 | \n",
- " 35460.1315 | \n",
- " 23747.96192 | \n",
- " 0.038 | \n",
- " 0.2500 | \n",
- " 0.2880 | \n",
- "
\n",
- " \n",
- " 5 | \n",
- " 6.0 | \n",
- " -841.500000 | \n",
- " 1683.00000 | \n",
- " 11000.0 | \n",
- " 11000.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.00 | \n",
- " 0.0000 | \n",
- " ... | \n",
- " 0.00 | \n",
- " 0.0 | \n",
- " 841.500000 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0000 | \n",
- " 1683.00000 | \n",
- " 0.153 | \n",
- " -0.0765 | \n",
- " 0.0765 | \n",
- "
\n",
- " \n",
- " 6 | \n",
- " 7.0 | \n",
- " -6740.192588 | \n",
- " 5967.00000 | \n",
- " 39000.0 | \n",
- " 39250.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 8004.45 | \n",
- " 800.4450 | \n",
- " ... | \n",
- " 2800.00 | \n",
- " 0.0 | \n",
- " 3940.192588 | \n",
- " 0.0 | \n",
- " 0.0 | \n",
- " 800.4450 | \n",
- " 5967.00000 | \n",
- " 0.153 | \n",
- " 0.2106 | \n",
- " 0.3636 | \n",
- "
\n",
- " \n",
- "
\n",
- "
7 rows × 21 columns
\n",
- "
"
- ],
- "text/plain": [
- " ID Individual Income Tax Payroll Tax Wages AGI UI in AGI \\\n",
- "0 1.0 21502.221500 21137.96192 160000.0 164500.0 0.0 \n",
- "1 2.0 -8588.529664 7267.50000 47500.0 47800.0 0.0 \n",
- "2 3.0 6981.016500 10710.00000 70000.0 80000.0 0.0 \n",
- "3 4.0 -1349.870000 18819.00000 123000.0 124200.0 0.0 \n",
- "4 5.0 33505.731500 23747.96192 250000.0 251200.0 0.0 \n",
- "5 6.0 -841.500000 1683.00000 11000.0 11000.0 0.0 \n",
- "6 7.0 -6740.192588 5967.00000 39000.0 39250.0 0.0 \n",
- "\n",
- " OASDI in AGI Itemized Deductions Taxable Inc Regular Tax ... \\\n",
- "0 0.0 0.0 133254.45 25502.2215 ... \n",
- "1 0.0 0.0 0.00 0.0000 ... \n",
- "2 0.0 0.0 59169.63 6981.0165 ... \n",
- "3 0.0 0.0 56501.30 5650.1300 ... \n",
- "4 0.0 0.0 204331.66 35460.1315 ... \n",
- "5 0.0 0.0 0.00 0.0000 ... \n",
- "6 0.0 0.0 8004.45 800.4450 ... \n",
- "\n",
- " CTC Refundable Child care credit EITC AMT \\\n",
- "0 0.00 0.0 0.000000 0.0 \n",
- "1 4200.00 0.0 4388.529664 0.0 \n",
- "2 0.00 0.0 0.000000 0.0 \n",
- "3 1349.87 0.0 0.000000 0.0 \n",
- "4 0.00 0.0 0.000000 0.0 \n",
- "5 0.00 0.0 841.500000 0.0 \n",
- "6 2800.00 0.0 3940.192588 0.0 \n",
- "\n",
- " Net Investment Income Tax Income Tax Before Credits FICA \\\n",
- "0 0.0 25502.2215 21137.96192 \n",
- "1 0.0 0.0000 7267.50000 \n",
- "2 0.0 6981.0165 10710.00000 \n",
- "3 0.0 5650.1300 18819.00000 \n",
- "4 45.6 35460.1315 23747.96192 \n",
- "5 0.0 0.0000 1683.00000 \n",
- "6 0.0 800.4450 5967.00000 \n",
- "\n",
- " Payroll Tax MTR Income Tax MTR Combined MTR \n",
- "0 0.029 0.2500 0.2790 \n",
- "1 0.153 0.2106 0.3636 \n",
- "2 0.153 0.2500 0.4030 \n",
- "3 0.153 0.1000 0.2530 \n",
- "4 0.038 0.2500 0.2880 \n",
- "5 0.153 -0.0765 0.0765 \n",
- "6 0.153 0.2106 0.3636 \n",
- "\n",
- "[7 rows x 21 columns]"
- ]
- },
- "execution_count": 6,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# outputs under preset reform (from https://github.com/PSLmodels/Tax-Calculator/tree/master/taxcalc/reforms)\n",
- "b.create_table('Renacci.json')"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "taxcrunch-env",
- "language": "python",
- "name": "taxcrunch-env"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.7.3"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}
diff --git a/docs/example_single.ipynb b/docs/example_single.ipynb
deleted file mode 100644
index e79eecc..0000000
--- a/docs/example_single.ipynb
+++ /dev/null
@@ -1,491 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "outputs": [],
- "source": [
- "from taxcrunch.cruncher import Cruncher"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 2,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "CTC_c was redefined in release 1.0.0\n",
- "\n"
- ]
- }
- ],
- "source": [
- "path = '../docs/example_adjustment.json'\n",
- "c = Cruncher(path)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 3,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " Base | \n",
- " Reform | \n",
- " Change | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " Individual Income Tax | \n",
- " 2385.95 | \n",
- " 4636.89 | \n",
- " 2250.94 | \n",
- "
\n",
- " \n",
- " Income Tax MTR | \n",
- " 0.11 | \n",
- " 0.14 | \n",
- " 0.03 | \n",
- "
\n",
- " \n",
- " Payroll Tax | \n",
- " 10710.00 | \n",
- " 10710.00 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- " Payroll Tax MTR | \n",
- " 0.14 | \n",
- " 0.14 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " Base Reform Change\n",
- "Individual Income Tax 2385.95 4636.89 2250.94\n",
- "Income Tax MTR 0.11 0.14 0.03\n",
- "Payroll Tax 10710.00 10710.00 0.00\n",
- "Payroll Tax MTR 0.14 0.14 0.00"
- ]
- },
- "execution_count": 3,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# basic outputs\n",
- "c.basic_table()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 4,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " Base | \n",
- " Reform | \n",
- " Change | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " Income Tax MTR | \n",
- " 0.111 | \n",
- " 0.139 | \n",
- " 0.028 | \n",
- "
\n",
- " \n",
- " Payroll Tax MTR | \n",
- " 0.142 | \n",
- " 0.142 | \n",
- " 0.000 | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " Base Reform Change\n",
- "Income Tax MTR 0.111 0.139 0.028\n",
- "Payroll Tax MTR 0.142 0.142 0.000"
- ]
- },
- "execution_count": 4,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# marginal tax rates\n",
- "c.mtr_table()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 5,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " Base | \n",
- " Reform | \n",
- " + $1 | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " AGI | \n",
- " 81000.00 | \n",
- " 81000.00 | \n",
- " 81001.00 | \n",
- "
\n",
- " \n",
- " UI in AGI | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- " OASDI in AGI | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- " Itemized Deductions | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- " Taxable Inc | \n",
- " 56462.40 | \n",
- " 50752.47 | \n",
- " 50753.47 | \n",
- "
\n",
- " \n",
- " Regular Tax | \n",
- " 6385.95 | \n",
- " 6636.89 | \n",
- " 6637.04 | \n",
- "
\n",
- " \n",
- " CTC | \n",
- " 4000.00 | \n",
- " 2000.00 | \n",
- " 2000.00 | \n",
- "
\n",
- " \n",
- " CTC Refundable | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- " Child care credit | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- " EITC | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- " AMT Taxable Income | \n",
- " 81000.00 | \n",
- " 81000.00 | \n",
- " 81001.00 | \n",
- "
\n",
- " \n",
- " AMT Liability | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- " Net Investment Income Tax | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- " Income Tax Before Credits | \n",
- " 6385.95 | \n",
- " 6636.89 | \n",
- " 6637.04 | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " Base Reform + $1\n",
- "AGI 81000.00 81000.00 81001.00\n",
- "UI in AGI 0.00 0.00 0.00\n",
- "OASDI in AGI 0.00 0.00 0.00\n",
- "Itemized Deductions 0.00 0.00 0.00\n",
- "Taxable Inc 56462.40 50752.47 50753.47\n",
- "Regular Tax 6385.95 6636.89 6637.04\n",
- "CTC 4000.00 2000.00 2000.00\n",
- "CTC Refundable 0.00 0.00 0.00\n",
- "Child care credit 0.00 0.00 0.00\n",
- "EITC 0.00 0.00 0.00\n",
- "AMT Taxable Income 81000.00 81000.00 81001.00\n",
- "AMT Liability 0.00 0.00 0.00\n",
- "Net Investment Income Tax 0.00 0.00 0.00\n",
- "Income Tax Before Credits 6385.95 6636.89 6637.04"
- ]
- },
- "execution_count": 5,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# detailed outputs with marginal tax rate analysis\n",
- "c.calc_table()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 6,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " Base | \n",
- " Reform | \n",
- " Change | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " AGI | \n",
- " 81000.00 | \n",
- " 81000.00 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- " UI in AGI | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- " OASDI in AGI | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- " Itemized Deductions | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- " Taxable Inc | \n",
- " 56462.40 | \n",
- " 50752.47 | \n",
- " -5709.93 | \n",
- "
\n",
- " \n",
- " Regular Tax | \n",
- " 6385.95 | \n",
- " 6636.89 | \n",
- " 250.94 | \n",
- "
\n",
- " \n",
- " CTC | \n",
- " 4000.00 | \n",
- " 2000.00 | \n",
- " -2000.00 | \n",
- "
\n",
- " \n",
- " CTC Refundable | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- " Child care credit | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- " EITC | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- " AMT Taxable Income | \n",
- " 81000.00 | \n",
- " 81000.00 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- " AMT Liability | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- " Net Investment Income Tax | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- " 0.00 | \n",
- "
\n",
- " \n",
- " Income Tax Before Credits | \n",
- " 6385.95 | \n",
- " 6636.89 | \n",
- " 250.94 | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " Base Reform Change\n",
- "AGI 81000.00 81000.00 0.00\n",
- "UI in AGI 0.00 0.00 0.00\n",
- "OASDI in AGI 0.00 0.00 0.00\n",
- "Itemized Deductions 0.00 0.00 0.00\n",
- "Taxable Inc 56462.40 50752.47 -5709.93\n",
- "Regular Tax 6385.95 6636.89 250.94\n",
- "CTC 4000.00 2000.00 -2000.00\n",
- "CTC Refundable 0.00 0.00 0.00\n",
- "Child care credit 0.00 0.00 0.00\n",
- "EITC 0.00 0.00 0.00\n",
- "AMT Taxable Income 81000.00 81000.00 0.00\n",
- "AMT Liability 0.00 0.00 0.00\n",
- "Net Investment Income Tax 0.00 0.00 0.00\n",
- "Income Tax Before Credits 6385.95 6636.89 250.94"
- ]
- },
- "execution_count": 6,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "#detailed outputs with difference between reform and baseline\n",
- "c.calc_diff_table()"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.6.8"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}
diff --git a/taxcrunch/multi_cruncher.py b/taxcrunch/multi_cruncher.py
index 1063101..5c56ff8 100644
--- a/taxcrunch/multi_cruncher.py
+++ b/taxcrunch/multi_cruncher.py
@@ -3,6 +3,7 @@
import numpy as np
import pandas as pd
import taxcalc as tc
+import behresp as br
from paramtools import Parameters
from taxcrunch import cruncher as cr
from datetime import date
@@ -10,6 +11,8 @@
CURRENT_PATH = os.path.abspath(os.path.dirname(__file__))
+FINITE_DIFF = 0.01
+
class BatchParams(Parameters):
@@ -42,7 +45,8 @@ class instance: Batch
def __init__(self, path):
self.path = path
- self.invar, self.rows = self.read_input()
+ self.invar, self.invar_marg, self.rows = self.read_input()
+ self.mtr = self.calc_mtr(reform_file=None)
self.tc_vars = [
"RECID",
@@ -120,61 +124,90 @@ def read_input(self):
'value'][0]['value']], axis=0)
params_df = pd.DataFrame(array).transpose()
+ params_marg = params_df.copy()
+ params_marg.loc[:, 9] = params_marg.loc[:, 9] + FINITE_DIFF
+
# translate INPUT variables into OUTPUT variables
c = cr.Cruncher()
self.invar = c.translate(params_df)
+ self.invar_marg = c.translate(params_marg)
self.rows = len(self.invar.index)
- return self.invar, self.rows
+ return self.invar, self.invar_marg, self.rows
- def create_table(self, reform_file=None):
+ def create_table(self, reform_file=None, be_sub=0, be_inc=0, be_cg=0):
"""
- Creates table of liabilities. Default is current law, but user may specify
- a policy reform which is read and implemented below in get_pol()
+ Creates table of liabilities. Default is current law with no behavioral response
+ (i.e. static analysis). User may specify a policy reform which is read and
+ implemented below in get_pol() and/or or may specify elasticities for partial-
+ equilibrium behavioral responses.
+
+ reform_file: name of a reform file in the Tax-Calculator reforms folder,
+ a file path to a custom JSON reform file, or a dictionary with a policy reform.
+
+ be_sub: Substitution elasticity of taxable income. Defined as proportional change
+ in taxable income divided by proportional change in marginal net-of-tax rate
+ (1-MTR) on taxpayer earnings caused by the reform. Must be zero or positive.
- The reform_file argument can be the name of a reform file in the
- Tax-Calculator reforms folder, a file path to a custom JSON
- reform file, or a dictionary with a policy reform.
+ be_inc: Income elasticity of taxable income. Defined as dollar change in taxable
+ income divided by dollar change in after-tax income caused by the reform.
+ Must be zero or negative.
+
+ be_cg: Semi-elasticity of long-term capital gains. Defined as change in logarithm
+ of long-term capital gains divided by change in marginal tax rate (MTR) on
+ long-term capital gains caused by the reform. Must be zero or negative.
Returns:
df_res: a Pandas dataframe. Each observation is a separate tax filer
"""
- pol = self.get_pol(reform_file)
year = self.invar['FLPDYR'][0]
year = int(year.item())
recs = tc.Records(data=self.invar, start_year=year)
- calc = tc.Calculator(policy=pol, records=recs)
- calc.advance_to_year(year)
- calc.calc_all()
- calcs = calc.dataframe(self.tc_vars)
- mtr = calc.mtr(wrt_full_compensation=False)
+
+ if reform_file == None:
+ pol = tc.Policy()
+ assert be_sub == be_inc == be_cg == 0
+ calc = tc.Calculator(policy=pol, records=recs)
+ calc.advance_to_year(year)
+ calc.calc_all()
+ calcs = calc.dataframe(self.tc_vars)
+ else:
+ pol = self.get_pol(reform_file)
+ calc = tc.Calculator(policy=pol, records=recs)
+ pol_base = tc.Policy()
+ calc_base = tc.Calculator(policy=pol_base, records=recs)
+ response_elasticities = {'sub': be_sub, 'inc': be_inc, 'cg': be_cg}
+ _, df2br = br.response(
+ calc_base, calc, response_elasticities, dump=True)
+ calcs = df2br[self.tc_vars]
+
+ mtr = self.calc_mtr(reform_file)
mtr_df = pd.DataFrame(data=mtr).transpose()
df_res = pd.concat([calcs, mtr_df], axis=1)
df_res.columns = self.labels
df_res.index = range(self.rows)
return df_res
- def create_diff_table(self, reform_file, baseline=None):
+ def create_diff_table(self, reform_file, baseline=None, be_sub=0, be_inc=0, be_cg=0):
"""
- Creates a table that displays differences between baseline and reform.
+ Creates a table that displays differences between baseline and reform. See the above
+ docstring for a discussion on the method's arguments.
- Baseline default is current law.
+ NOTE: if a policy other than current law is selected as the baseline policy, behavioral
+ responses must remain 0.
- The reform_file argument can be the name of a reform file in the
- Tax-Calculator reforms folder, a file path to a custom JSON
- reform file, or a dictionary with a policy reform.
-
- Returns:
- df_diff_id: a Pandas dataframe.
"""
if baseline is None:
t_base = self.create_table()
else:
+ # a behavioral response can only be simulated if the baseline is
+ # current law
+ assert be_sub == be_inc == be_cg == 0
t_base = self.create_table(baseline)
- t_reform = self.create_table(reform_file)
+ t_reform = self.create_table(reform_file, be_sub, be_inc, be_cg)
df_all = pd.merge(t_reform, t_base, on='ID')
df_ids = df_all['ID']
cols = len(t_base.columns)
- df_diff = df_all.diff(periods= -(cols - 1),
+ df_diff = df_all.diff(periods=-(cols - 1),
axis=1).iloc[:, 1:cols]
df_diff_id = pd.concat([df_ids, df_diff], axis=1)
# new column labels that have "Diff" at the end
@@ -187,10 +220,10 @@ def create_diff_table(self, reform_file, baseline=None):
df_diff_id.columns = diff_labels
return df_diff_id
- def write_output_file(self, output_filename=None, reform_file=None):
+ def write_output_file(self, output_filename=None, reform_file=None, be_sub=0, be_inc=0, be_cg=0):
"""
Writes an output table as a csv. Like the create_table() method, default is current
- law and optional reform_file argument is a file path to or dictionary of a reform.
+ law and optional reform_file argument is a file path to json file or dictionary of a reform.
Default output filename is "cruncher-mm-dd-YYYY.csv" but user can change output filename
with output_filename argument.
@@ -199,16 +232,17 @@ def write_output_file(self, output_filename=None, reform_file=None):
today = date.today()
today_str = today.strftime("%m-%d-%Y")
output_filename = "cruncher-" + today_str + ".csv"
- df_res = self.create_table(reform_file)
+ df_res = self.create_table(reform_file, be_sub, be_inc, be_cg)
assert isinstance(df_res, pd.DataFrame)
df_res.to_csv(output_filename, index=False, float_format='%.2f')
- def write_diff_file(self, reform_file, baseline=None, output_filename=None):
+ def write_diff_file(self, reform_file, baseline=None, output_filename=None, be_sub=0, be_inc=0, be_cg=0):
if output_filename is None:
today = date.today()
today_str = today.strftime("%m-%d-%Y")
output_filename = "cruncher-diff-" + today_str + ".csv"
- df_res = self.create_diff_table(reform_file=reform_file, baseline=baseline)
+ df_res = self.create_diff_table(
+ reform_file, baseline, be_sub, be_inc, be_cg)
assert isinstance(df_res, pd.DataFrame)
df_res.to_csv(output_filename, index=False, float_format='%.2f')
@@ -222,26 +256,61 @@ def get_pol(self, reform_file):
"PSLmodels/Tax-Calculator/master/taxcalc/reforms/"
)
CURRENT_PATH = os.path.abspath(os.path.dirname(__file__))
- if reform_file == None:
+
+ # check to see if file path to reform_file exists
+ if isinstance(reform_file, str) and os.path.isfile(os.path.join(CURRENT_PATH, reform_file)):
+ reform_path = os.path.join(CURRENT_PATH, reform_file)
+ pol = tc.Policy()
+ pol.implement_reform(tc.Policy.read_json_reform(reform_path))
+ # try reform_file as dictionary
+ elif isinstance(reform_file, dict):
+ reform = reform_file
pol = tc.Policy()
+ pol.implement_reform(reform)
+ # if file path does not exist, check Tax-Calculator reforms file
else:
- # check to see if file path to reform_file exists
- if isinstance(reform_file, str) and os.path.isfile(os.path.join(CURRENT_PATH, reform_file)):
- reform_path = os.path.join(CURRENT_PATH, reform_file)
+ try:
+ reform_url = REFORMS_URL + reform_file
pol = tc.Policy()
- pol.implement_reform(tc.Policy.read_json_reform(reform_path))
- # try reform_file as dictionary
- elif isinstance(reform_file, dict):
- reform = reform_file
- pol = tc.Policy()
- pol.implement_reform(reform)
- # if file path does not exist, check Tax-Calculator reforms file
- else:
- try:
- reform_url = REFORMS_URL + reform_file
- pol = tc.Policy()
- pol.implement_reform(
- tc.Policy.read_json_reform(reform_url))
- except:
- raise 'Reform file does not exist'
+ pol.implement_reform(
+ tc.Policy.read_json_reform(reform_url))
+ except:
+ raise 'Reform file does not exist'
return pol
+
+ def calc_mtr(self, reform_file):
+ """
+ Calculates income tax, payroll tax, and combined marginal rates
+ """
+ year = self.invar['FLPDYR'][0]
+ year = int(year.item())
+ recs_base = tc.Records(data=self.invar, start_year=year)
+ if reform_file == None:
+ pol = tc.Policy()
+ else:
+ pol = self.get_pol(reform_file)
+
+ calc_base = tc.Calculator(policy=pol, records=recs_base)
+ calc_base.advance_to_year(year)
+ calc_base.calc_all()
+ payrolltax_base = calc_base.array('payrolltax')
+ incometax_base = calc_base.array('iitax')
+ combined_taxes_base = incometax_base + payrolltax_base
+
+ recs_marg = tc.Records(data=self.invar_marg, start_year=year)
+ calc_marg = tc.Calculator(policy=pol, records=recs_marg)
+ calc_marg.advance_to_year(year)
+ calc_marg.calc_all()
+ payrolltax_marg = calc_marg.array('payrolltax')
+ incometax_marg = calc_marg.array('iitax')
+ combined_taxes_marg = incometax_marg + payrolltax_marg
+
+ payrolltax_diff = payrolltax_marg - payrolltax_base
+ incometax_diff = incometax_marg - incometax_base
+ combined_diff = combined_taxes_marg - combined_taxes_base
+
+ mtr_payrolltax = payrolltax_diff / FINITE_DIFF
+ mtr_incometax = incometax_diff / FINITE_DIFF
+ mtr_combined = combined_diff / FINITE_DIFF
+
+ return (mtr_payrolltax, mtr_incometax, mtr_combined)
diff --git a/taxcrunch/tests/test_multi_cruncher.py b/taxcrunch/tests/test_multi_cruncher.py
index 9e70427..7c0eb7d 100644
--- a/taxcrunch/tests/test_multi_cruncher.py
+++ b/taxcrunch/tests/test_multi_cruncher.py
@@ -7,38 +7,42 @@
import taxcrunch.cruncher as cr
import taxcrunch.multi_cruncher as mcr
-def test_get_pol_no_reform():
- b = mcr.Batch(path="tests/example_test_input.csv")
- assert isinstance(b, mcr.Batch)
- m = b.get_pol(reform_file=None)
- assert isinstance(m,tc.Policy)
-
-def test_get_pol_directory_file():
- b = mcr.Batch(path="tests/example_test_input.csv")
- # use the full file pathname for testing purposes
- local_reform = "tests/test_reform.json"
- n = b.get_pol(reform_file=local_reform)
- assert n._CTC_c[2018-2013] == 1000
+b = mcr.Batch(path="tests/example_test_input.csv")
reform_dict = {
"CTC_c": {2013: 1300, 2018: 1800}
}
-def test_get_pol_dict():
- b = mcr.Batch(path="tests/example_test_input.csv")
+def test_read_input(crunch=b):
+
+ invar, invar_marg, rows = b.read_input()
+ assert isinstance(invar, pd.DataFrame)
+ assert isinstance(rows, int)
+
+ # check that number of input rows matches output rows
+ assert rows == len(b.create_table().index)
+
+def test_get_pol_directory_file(crunch=b):
+
+ local_reform = "tests/test_reform.json"
+ n = b.get_pol(reform_file=local_reform)
+ assert n._CTC_c[2018-2013] == 1000
+
+def test_get_pol_dict(crunch=b):
+
m = b.get_pol(reform_file=reform_dict)
assert m._CTC_c[2018-2013] == 1800
-def test_get_pol_link():
- b = mcr.Batch(path="tests/example_test_input.csv")
+def test_get_pol_link(crunch=b):
+
reform_preset = "Trump2016.json"
m = b.get_pol(reform_file=reform_preset)
assert m._II_rt1[2017-2013] == 0.12
CURR_PATH = os.path.abspath(os.path.dirname(__file__))
-def test_calc_table():
- b = mcr.Batch(path="tests/example_test_input.csv")
+def test_calc_table(crunch=b):
+
table = b.create_table()
assert isinstance(table, pd.DataFrame)
# table.to_csv("expected_multi_table.csv")
@@ -46,4 +50,30 @@ def test_calc_table():
os.path.join(CURR_PATH, "expected_multi_table.csv"), index_col=0
)
for col in table.columns:
- assert np.allclose(table[col], expected_table[col])
\ No newline at end of file
+ assert np.allclose(table[col], expected_table[col])
+
+def test_create_table_behresp_args(crunch=b):
+
+ table = b.create_table(reform_file=reform_dict, be_sub=0.25)
+ assert isinstance(table, pd.DataFrame)
+
+ # be_sub must be positive
+ with pytest.raises(AssertionError):
+ b.create_table(reform_file=reform_dict, be_sub=-0.25)
+
+ # can only specify response if there is a reform
+ with pytest.raises(AssertionError):
+ b.create_table(be_sub=0.25)
+
+def test_diff_tables(crunch=b):
+
+ table = b.create_diff_table(reform_file=reform_dict)
+ assert isinstance(table,pd.DataFrame)
+
+ # can only specify response if there is a reform
+ with pytest.raises(AssertionError):
+ b.create_diff_table(reform_file=None, be_sub=0.25)
+
+ # baseline must be current law if response
+ with pytest.raises(AssertionError):
+ b.create_diff_table(reform_file="Trump2016.json", baseline=reform_dict, be_sub=0.25)