Skip to content

Commit

Permalink
Add income variables
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilwoodruff committed Feb 9, 2024
1 parent 6f34a1e commit 4ba2250
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ format:
black . -l 79

flat-file:
python tax_microdata_benchmarking/create_flat_file.py
python tax_microdata_benchmarking/create_flat_file.py

all: format test
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
version="0.1.0",
packages=find_packages(),
install_requires=[
"policyengine_us==0.648.0",
"taxcalc==3.4.1",
"paramtools==0.18.1",
"policyengine_us>=0.648.0",
"taxcalc>=3.4.1",
"paramtools>=0.18.1",
"pytest",
"black",
],
Expand Down
170 changes: 170 additions & 0 deletions tax_microdata_benchmarking/create_flat_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def formula(tax_unit, period, parameters):


class tc_e00200(TaxCalcVariableAlias):
label = "wages less pension contributions"

adds = [
"tc_e00200p",
"tc_e00200s",
Expand Down Expand Up @@ -193,6 +195,156 @@ class tc_f2441(TaxCalcVariableAlias):
adds = ["count_cdcc_eligible"]


class tc_e00900p(TaxCalcVariableAlias):
label = "self-employment income"

def formula(tax_unit, period, parameters):
person = tax_unit.members
self_employment_income = person("self_employment_income", period)
is_tax_unit_head = person("is_tax_unit_head", period)
return tax_unit.sum(self_employment_income * is_tax_unit_head)


class tc_e00900s(TaxCalcVariableAlias):
label = "self-employment income (spouse)"

def formula(tax_unit, period, parameters):
person = tax_unit.members
self_employment_income = person("self_employment_income", period)
is_tax_unit_spouse = person("is_tax_unit_spouse", period)
return tax_unit.sum(self_employment_income * is_tax_unit_spouse)


class tc_e00900(TaxCalcVariableAlias):
label = "self-employment income"
adds = ["tc_e00900p", "tc_e00900s"]


class tc_e02100p(TaxCalcVariableAlias):
label = "farm income"

def formula(tax_unit, period, parameters):
person = tax_unit.members
farm_income = person("farm_income", period)
is_tax_unit_head = person("is_tax_unit_head", period)
return tax_unit.sum(farm_income * is_tax_unit_head)


class tc_e02100s(TaxCalcVariableAlias):
label = "farm income (spouse)"

def formula(tax_unit, period, parameters):
person = tax_unit.members
farm_income = person("farm_income", period)
is_tax_unit_spouse = person("is_tax_unit_spouse", period)
return tax_unit.sum(farm_income * is_tax_unit_spouse)


class tc_e02100(TaxCalcVariableAlias):
label = "farm income"
adds = ["tc_e02100p", "tc_e02100s"]


class tc_e01500p(TaxCalcVariableAlias):
label = "pension income"

def formula(tax_unit, period, parameters):
person = tax_unit.members
pension_income = person("pension_income", period)
is_tax_unit_head = person("is_tax_unit_head", period)
return tax_unit.sum(pension_income * is_tax_unit_head)


class tc_e01500s(TaxCalcVariableAlias):
label = "pension income (spouse)"

def formula(tax_unit, period, parameters):
person = tax_unit.members
pension_income = person("pension_income", period)
is_tax_unit_spouse = person("is_tax_unit_spouse", period)
return tax_unit.sum(pension_income * is_tax_unit_spouse)


class tc_e01500(TaxCalcVariableAlias):
label = "pension income"
adds = ["tc_e01500p", "tc_e01500s"]


class tc_e00800p(TaxCalcVariableAlias):
label = "alimony income"

def formula(tax_unit, period, parameters):
person = tax_unit.members
alimony_income = person("alimony_income", period)
is_tax_unit_head = person("is_tax_unit_head", period)
return tax_unit.sum(alimony_income * is_tax_unit_head)


class tc_e00800s(TaxCalcVariableAlias):
label = "alimony income (spouse)"

def formula(tax_unit, period, parameters):
person = tax_unit.members
alimony_income = person("alimony_income", period)
is_tax_unit_spouse = person("is_tax_unit_spouse", period)
return tax_unit.sum(alimony_income * is_tax_unit_spouse)


class tc_e00800(TaxCalcVariableAlias):
label = "alimony income"
adds = ["tc_e00800p", "tc_e00800s"]


class tc_e02400p(TaxCalcVariableAlias):
label = "social security income"

def formula(tax_unit, period, parameters):
person = tax_unit.members
social_security_income = person("social_security", period)
is_tax_unit_head = person("is_tax_unit_head", period)
return tax_unit.sum(social_security_income * is_tax_unit_head)


class tc_e02400s(TaxCalcVariableAlias):
label = "social security income (spouse)"

def formula(tax_unit, period, parameters):
person = tax_unit.members
social_security_income = person("social_security", period)
is_tax_unit_spouse = person("is_tax_unit_spouse", period)
return tax_unit.sum(social_security_income * is_tax_unit_spouse)


class tc_e02400(TaxCalcVariableAlias):
label = "social security income"
adds = ["tc_e02400p", "tc_e02400s"]


class tc_e02300p(TaxCalcVariableAlias):
label = "unemployment compensation"

def formula(tax_unit, period, parameters):
person = tax_unit.members
unemployment_compensation = person("unemployment_compensation", period)
is_tax_unit_head = person("is_tax_unit_head", period)
return tax_unit.sum(unemployment_compensation * is_tax_unit_head)


class tc_e02300s(TaxCalcVariableAlias):
label = "unemployment compensation (spouse)"

def formula(tax_unit, period, parameters):
person = tax_unit.members
unemployment_compensation = person("unemployment_compensation", period)
is_tax_unit_spouse = person("is_tax_unit_spouse", period)
return tax_unit.sum(unemployment_compensation * is_tax_unit_spouse)


class tc_e02300(TaxCalcVariableAlias):
label = "unemployment compensation"
adds = ["tc_302300p", "tc_302300s"]


class taxcalc_extension(Reform):
def apply(self):
self.add_variables(
Expand All @@ -216,6 +368,24 @@ def apply(self):
tc_n24,
tc_elderly_dependents,
tc_f2441,
tc_e00900p,
tc_e00900s,
tc_e00900,
tc_e02100p,
tc_e02100s,
tc_e02100,
tc_e01500p,
tc_e01500s,
tc_e01500,
tc_e00800p,
tc_e00800s,
tc_e00800,
tc_e02400p,
tc_e02400s,
tc_e02400,
tc_e02300p,
tc_e02300s,
tc_e02300,
)


Expand Down

0 comments on commit 4ba2250

Please sign in to comment.