Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redefine child/dependent input parameters #53

Merged
merged 6 commits into from
Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cs-config/cs_config/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ def get_inputs(meta_params_dict):
"mstat",
"page",
"sage",
"depx",
"dep13",
"dep17",
"dep18",
"otherdep",
"pwages",
"swages",
"dividends",
Expand Down
14 changes: 7 additions & 7 deletions docs/INPUT_INSTRUCTIONS.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
How to specify CSV input file
------

To analyze multiple tax filers, the user must specify a csv file with the filers' data. Each row of the csv file represents a filer and each column represents a variable. Please note that the file should not have column headings and year must be the same for all observations. The input file should have 24 columns in the following order:
To analyze multiple tax filers, the user creates a csv file with the filers' data. Each row of the csv file represents a filer and each column represents a variable. Please note that the file should not have column headings and the year must be the same for all observations. The input file should have 28 columns in the following order:

1. RECID (ID for tax filer)
2. year
3. mstat (1 - single; 2 - married)
4. page (age of primary taxpayer)
5. sage (age of spouse)
6. depx (number of dependents)
7. dep13 (number of children under 13)
8. dep17 (number of children under 17)
9. dep18 (number of qualifying children for EITC)
6. dep13 (number of children under 13)
7. dep17 (number of children from 13 to 16)
8. dep18 (number of children from 17 to 18 AND from 19 to 24 and a full-time student)
9. otherdep (other dependents)
10. pwages (wage of primary taxpayer)
11. swages (wage of spouse)
12. dividends (dividend income)
Expand All @@ -30,11 +30,11 @@ To analyze multiple tax filers, the user must specify a csv file with the filers
25. proptax (real estate taxes paid)
26. otheritem (other itemized deductions subject to SALT cap, e.g. state and local taxes)
27. childcare (child care expenses)
28. mortgage (itemized deductions not subject to SALT cap, e.g., charitable contributions and home mortgage interest)
28. mortgage (itemized deductions not subject to SALT cap, e.g. charitable contributions and home mortgage interest)


For example, a 50-year old single filer with 3 dependents under 13 who makes $50,000 per year could be represented by the following:

```
1,2019,1,50,0,3,3,3,3,50000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1,2019,1,50,0,3,0,0,0,50000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
```
81 changes: 41 additions & 40 deletions docs/cruncher_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"metadata": {},
"outputs": [],
"source": [
"# import the Batch class\n",
"from taxcrunch.multi_cruncher import Batch\n",
"import os"
]
Expand All @@ -34,23 +33,17 @@
"CURRENT_PATH = os.path.abspath(os.path.dirname('file'))\n",
"path = os.path.join(CURRENT_PATH, \"example_input.csv\")\n",
"\n",
"# initialize an object of the Batch class\n",
"# create Batch object\n",
"b = Batch(path)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Outputs\n",
"## Analyzing tax data under current law\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). "
"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."
]
},
{
Expand Down Expand Up @@ -106,15 +99,15 @@
" <tr>\n",
" <th>0</th>\n",
" <td>1.0</td>\n",
" <td>23425.0000</td>\n",
" <td>21425.0000</td>\n",
" <td>21119.6</td>\n",
" <td>160000.0</td>\n",
" <td>164500.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>146150.00</td>\n",
" <td>4000.0</td>\n",
" <td>6000.0</td>\n",
" <td>...</td>\n",
" <td>0.000</td>\n",
" <td>164500.0</td>\n",
Expand Down Expand Up @@ -278,7 +271,7 @@
],
"text/plain": [
" ID Individual Income Tax Payroll Tax Wages AGI UI in AGI \\\n",
"0 1.0 23425.0000 21119.6 160000.0 164500.0 0.0 \n",
"0 1.0 21425.0000 21119.6 160000.0 164500.0 0.0 \n",
"1 2.0 -5333.4120 7267.5 47500.0 47800.0 0.0 \n",
"2 3.0 30012.9128 10710.0 70000.0 180000.0 0.0 \n",
"3 4.0 7589.0000 18819.0 123000.0 124200.0 0.0 \n",
Expand All @@ -287,7 +280,7 @@
"6 7.0 -3368.6680 5967.0 39000.0 39250.0 0.0 \n",
"\n",
" OASDI in AGI Itemized Deductions Taxable Inc CTC ... EITC \\\n",
"0 0.0 0.0 146150.00 4000.0 ... 0.000 \n",
"0 0.0 0.0 146150.00 6000.0 ... 0.000 \n",
"1 0.0 0.0 23400.00 2384.0 ... 1717.412 \n",
"2 0.0 0.0 153076.72 0.0 ... 0.000 \n",
"3 0.0 0.0 99800.00 6000.0 ... 0.000 \n",
Expand Down Expand Up @@ -331,10 +324,18 @@
}
],
"source": [
"# outputs under current law (no reform)\n",
"b.create_table()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Analyzing tax data under a policy reform\n",
"\n",
"To analyze a policy reform, specify the `reform_file` argument in the `create_table()` method. You may enter the file path to a json reform file, a Python 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 your reform adheres to Tax-Calculator [guidelines](https://github.com/PSLmodels/Tax-Calculator/blob/master/taxcalc/reforms/REFORMS.md)."
]
},
{
"cell_type": "code",
"execution_count": 4,
Expand Down Expand Up @@ -395,12 +396,12 @@
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>142004.06</td>\n",
" <td>137766.45</td>\n",
" <td>0.000</td>\n",
" <td>...</td>\n",
" <td>0.000000</td>\n",
" <td>164500.0</td>\n",
" <td>942.53005</td>\n",
" <td>2008.73145</td>\n",
" <td>0.0</td>\n",
" <td>29986.60895</td>\n",
" <td>21119.6</td>\n",
Expand Down Expand Up @@ -569,7 +570,7 @@
"6 7.0 -1874.218124 5967.0 39000.0 39250.0 0.0 \n",
"\n",
" OASDI in AGI Itemized Deductions Taxable Inc CTC ... EITC \\\n",
"0 0.0 0.0 142004.06 0.000 ... 0.000000 \n",
"0 0.0 0.0 137766.45 0.000 ... 0.000000 \n",
"1 0.0 0.0 13323.66 1302.366 ... 1819.286764 \n",
"2 0.0 0.0 169118.24 0.000 ... 0.000000 \n",
"3 0.0 0.0 89723.66 2290.000 ... 0.000000 \n",
Expand All @@ -578,7 +579,7 @@
"6 0.0 0.0 16754.06 1777.189 ... 1651.407124 \n",
"\n",
" AMT Taxable Income AMT Liability Net Investment Income Tax \\\n",
"0 164500.0 942.53005 0.0 \n",
"0 164500.0 2008.73145 0.0 \n",
"1 47800.0 0.00000 0.0 \n",
"2 180000.0 0.00000 0.0 \n",
"3 124200.0 0.00000 0.0 \n",
Expand Down Expand Up @@ -613,7 +614,6 @@
}
],
"source": [
"# outputs under reform\n",
"reform_path = os.path.join(CURRENT_PATH, \"../taxcrunch/tests/test_reform.json\")\n",
"b.create_table(reform_file=reform_path)"
]
Expand Down Expand Up @@ -671,19 +671,19 @@
" <tr>\n",
" <th>0</th>\n",
" <td>1.0</td>\n",
" <td>6561.608950</td>\n",
" <td>8561.608950</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>-4145.94</td>\n",
" <td>-4000.000</td>\n",
" <td>-8383.55</td>\n",
" <td>-6000.000</td>\n",
" <td>...</td>\n",
" <td>0.000000</td>\n",
" <td>0.0</td>\n",
" <td>942.53005</td>\n",
" <td>2008.73145</td>\n",
" <td>0.0</td>\n",
" <td>2561.60895</td>\n",
" <td>0.0</td>\n",
Expand Down Expand Up @@ -843,7 +843,7 @@
],
"text/plain": [
" ID Individual Income Tax Diff Payroll Tax Diff Wages Diff AGI Diff \\\n",
"0 1.0 6561.608950 0.0 0.0 0.0 \n",
"0 1.0 8561.608950 0.0 0.0 0.0 \n",
"1 2.0 1816.491236 0.0 0.0 0.0 \n",
"2 3.0 8696.845500 0.0 0.0 0.0 \n",
"3 4.0 3514.636500 0.0 0.0 0.0 \n",
Expand All @@ -861,7 +861,7 @@
"6 0.0 0.0 0.0 \n",
"\n",
" Taxable Inc Diff CTC Diff ... EITC Diff AMT Taxable Income Diff \\\n",
"0 -4145.94 -4000.000 ... 0.000000 0.0 \n",
"0 -8383.55 -6000.000 ... 0.000000 0.0 \n",
"1 -10076.34 -1081.634 ... 101.874764 0.0 \n",
"2 16041.52 0.000 ... 0.000000 0.0 \n",
"3 -10076.34 -3710.000 ... 0.000000 0.0 \n",
Expand All @@ -870,7 +870,7 @@
"6 -4145.94 -423.811 ... 81.739124 0.0 \n",
"\n",
" AMT Liability Diff Net Investment Income Tax Diff \\\n",
"0 942.53005 0.0 \n",
"0 2008.73145 0.0 \n",
"1 0.00000 0.0 \n",
"2 0.00000 0.0 \n",
"3 0.00000 0.0 \n",
Expand Down Expand Up @@ -914,6 +914,7 @@
}
],
"source": [
"# you can also create a difference table\n",
"b.create_diff_table(reform_file=reform_path)"
]
},
Expand All @@ -923,7 +924,7 @@
"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",
"Finally, the `Batch` class gives users the option to incorporate partial-equilibrium behavioral responses to a tax policy reform. The three optional arguments a dynamic analysis are:\n",
"\n",
"- `be_sub`: substitution elasticity of taxable income\n",
"- `be_inc`: income elasticity of taxable income\n",
Expand Down Expand Up @@ -992,12 +993,12 @@
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>137838.147840</td>\n",
" <td>133600.537840</td>\n",
" <td>0.000000</td>\n",
" <td>...</td>\n",
" <td>0.000000</td>\n",
" <td>160334.087840</td>\n",
" <td>636.885538</td>\n",
" <td>1696.288038</td>\n",
" <td>0.0</td>\n",
" <td>28632.687498</td>\n",
" <td>21002.093420</td>\n",
Expand Down Expand Up @@ -1166,7 +1167,7 @@
"6 7.0 -1969.553004 5926.807735 38737.305460 38985.621520 \n",
"\n",
" UI in AGI OASDI in AGI Itemized Deductions Taxable Inc CTC \\\n",
"0 0.0 0.0 0.0 137838.147840 0.000000 \n",
"0 0.0 0.0 0.0 133600.537840 0.000000 \n",
"1 0.0 0.0 0.0 13520.995131 1322.099513 \n",
"2 0.0 0.0 0.0 178320.003243 0.000000 \n",
"3 0.0 0.0 0.0 86886.417622 2431.862119 \n",
Expand All @@ -1175,7 +1176,7 @@
"6 0.0 0.0 0.0 16489.681520 1737.532228 \n",
"\n",
" ... EITC AMT Taxable Income AMT Liability \\\n",
"0 ... 0.000000 160334.087840 636.885538 \n",
"0 ... 0.000000 160334.087840 1696.288038 \n",
"1 ... 1777.727985 47997.335131 0.000000 \n",
"2 ... 0.000000 189201.763243 0.000000 \n",
"3 ... 0.000000 121362.757622 0.000000 \n",
Expand Down Expand Up @@ -1275,19 +1276,19 @@
" <tr>\n",
" <th>0</th>\n",
" <td>1.0</td>\n",
" <td>5207.687498</td>\n",
" <td>7207.687498</td>\n",
" <td>-117.506580</td>\n",
" <td>-4051.951037</td>\n",
" <td>-4165.912160</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>-8311.852160</td>\n",
" <td>-4000.000000</td>\n",
" <td>-12549.462160</td>\n",
" <td>-6000.000000</td>\n",
" <td>...</td>\n",
" <td>0.000000</td>\n",
" <td>-4165.912160</td>\n",
" <td>636.885538</td>\n",
" <td>1696.288038</td>\n",
" <td>0.0</td>\n",
" <td>1207.687498</td>\n",
" <td>-117.506580</td>\n",
Expand Down Expand Up @@ -1447,7 +1448,7 @@
],
"text/plain": [
" ID Individual Income Tax Diff Payroll Tax Diff Wages Diff \\\n",
"0 1.0 5207.687498 -117.506580 -4051.951037 \n",
"0 1.0 7207.687498 -117.506580 -4051.951037 \n",
"1 2.0 1877.783528 30.002784 196.096626 \n",
"2 3.0 11273.339208 547.504913 3578.463483 \n",
"3 4.0 2663.463786 -429.903900 -2809.829409 \n",
Expand All @@ -1465,7 +1466,7 @@
"6 -264.378480 0.0 0.0 0.0 \n",
"\n",
" Taxable Inc Diff CTC Diff ... EITC Diff AMT Taxable Income Diff \\\n",
"0 -8311.852160 -4000.000000 ... 0.000000 -4165.912160 \n",
"0 -12549.462160 -6000.000000 ... 0.000000 -4165.912160 \n",
"1 -9879.004869 -1061.900487 ... 60.315985 197.335131 \n",
"2 25243.283243 0.000000 ... 0.000000 9201.763243 \n",
"3 -12913.582378 -3568.137881 ... 0.000000 -2837.242378 \n",
Expand All @@ -1474,7 +1475,7 @@
"6 -4410.318480 -463.467772 ... 137.417232 -264.378480 \n",
"\n",
" AMT Liability Diff Net Investment Income Tax Diff \\\n",
"0 636.885538 0.0 \n",
"0 1696.288038 0.0 \n",
"1 0.000000 0.0 \n",
"2 0.000000 0.0 \n",
"3 0.000000 0.0 \n",
Expand Down Expand Up @@ -1538,7 +1539,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.6.11"
}
},
"nbformat": 4,
Expand Down
10 changes: 5 additions & 5 deletions docs/example_input.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
1,2019,1,50,0,2,1,2,2,160000,0,4500,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2,2019,2,38,0,3,2,3,3,35000,12500,300,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1,2019,1,50,0,1,2,0,0,160000,0,4500,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2,2019,2,38,0,2,1,0,0,35000,12500,300,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
3,2019,1,58,0,0,0,0,0,70000,0,10000,0,0,0,100000,1,0,0,0,0,0,0,0,0,0,0,0
4,2019,2,44,0,3,1,3,3,80000,43000,1200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5,2019,2,27,0,1,1,1,1,250000,0,1200,0,0,0,50000,0,0,0,0,0,0,0,0,0,0,0,0
4,2019,2,44,0,1,2,0,0,80000,43000,1200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5,2019,2,27,0,1,0,0,0,250000,0,1200,0,0,0,50000,0,0,0,0,0,0,0,0,0,0,0,0
6,2019,2,19,0,0,0,0,0,11000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
7,2019,1,48,0,2,2,2,2,39000,0,250,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
7,2019,1,48,0,2,0,0,0,39000,0,250,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
6 changes: 3 additions & 3 deletions taxcrunch/adjustment_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
"sage": [
{"value": 0}
],
"depx": [
{"value": 0}
],
"dep13": [
{"value": 0}
],
Expand All @@ -23,6 +20,9 @@
"dep18": [
{"value": 0}
],
"otherdep": [
{"value": 0}
],
"pwages": [
{"value": 0}
],
Expand Down
Loading