Open yvvijay121 opened 2 years ago
@nikhilwoodruff is it expected that adult dependents nullify much of the EITC value? From this notebook:
OK, so the answer is no, but it's the input method rather than the simulation that causes it. The core issue is that each variable must be provided for every entity, or none - if it's provided for one, it'll have the default value for the others. I think there's a strong case to replace this behaviour with executing the formula to fill in the missing values. But the issue specifically here is that is_tax_unit_provided
is provided only for the adult dependent. Adding is_tax_unit_dependent=True/False
to all other people in the simulation when they are defined fixes the issue for me:
from openfisca_us import IndividualSim
import pandas as pd
import plotly.express as px
def make_eitc(adults, adult_dependents, children):
sim = IndividualSim(year=2022)
sim.add_person(name="head", age=25, is_tax_unit_dependent=False)
members = ["head"]
if adults == 2:
sim.add_person(name="spouse", is_tax_unit_dependent=False)
members += ["spouse"]
for i in range(adult_dependents):
adult_dependent = "adult_dependent{}".format(i)
sim.add_person(name=adult_dependent, age=60, is_tax_unit_dependent=True)
members += [adult_dependent]
for i in range(children):
child = "child{}".format(i)
sim.add_person(name=child, age=6, is_tax_unit_dependent=True)
members += [child]
sim.add_tax_unit(name="tax_unit", members=members)
sim.add_household(name="household", members=members)
sim.vary("employment_income", max=60_000, step=100)
return pd.DataFrame(
dict(
employment_income=sim.calc("employment_income")[0],
eitc=sim.calc("eitc")[0].round(),
mtr=-sim.deriv("eitc", "employment_income", wrt_target="head"),
adults=adults,
adult_dependents=adult_dependents,
children=children,
)
)
# Make a table of EITC amounts for different numbers of children and adult dependents.
l = []
for children in range(0, 3):
for adult_dependents in range(0, 2):
l.append(make_eitc(1, adult_dependents, children))
df = pd.concat(l)
LABELS = dict(
employment_income="Employment income",
income_source="Income source",
eitc="Earned income tax credit",
mtr="EITC marginal tax rate",
adult_dependents="Adult dependents",
children="Children",
adults="Adults",
)
fig = px.line(
df,
"employment_income",
"eitc",
color="adult_dependents",
animation_frame="children",
labels=LABELS,
title="EITC by number of children and adult dependents, 2022",
)
fig.update_layout(xaxis_tickformat="$,", yaxis_tickformat="$,")
fig.show()
When calculating a single-head, two-child, one adult dependent household with $40K employment income, the
eitc
value is 0.However, when the person that was previously defined as a dependent is defined to no longer be an adult dependent, the
eitc
value is around $3000.