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

Fix two bugs in Behavior._update_ordinary_income method #846

Merged
merged 1 commit into from
Jul 27, 2016
Merged
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
10 changes: 5 additions & 5 deletions taxcalc/behavior.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,15 @@ def _update_ordinary_income(taxinc_change, calc):
"""
Implement total taxable income change induced by behavioral response.
"""
# assume no behv response for filing units with no, or negative, AGI
agi = calc.records.c00100
delta_income = np.where(agi > 0., taxinc_change, 0.)
# compute AGI minus itemized deductions, agi_m_ided
agi = calc.records.c00100
# pylint: disable=protected-access
ided = np.where(calc.records.c04470 < calc.records._standard,
0.,
calc.records.c04470)
agi_m_ided = agi - ided
# assume behv response only for filing units with positive agi_m_ided
delta_income = np.where(agi_m_ided > 0., taxinc_change, 0.)
# allocate delta_income into three parts
delta_wage = np.where(agi_m_ided > 0.,
delta_income * calc.records.e00200 / agi_m_ided,
Expand All @@ -201,8 +201,8 @@ def _update_ordinary_income(taxinc_change, calc):
delta_ided = np.where(agi_m_ided > 0.,
delta_income * ided / agi_m_ided,
0.)
# confirm that the three parts add up to delta_income
assert np.allclose(delta_income, delta_wage + delta_oinc + delta_ided)
# confirm that the three parts are consistent with delta_income
assert np.allclose(delta_income, delta_wage + delta_oinc - delta_ided)
# add the three parts to different calc.records variables
calc.records.e00200 = calc.records.e00200 + delta_wage
calc.records.e00200p = calc.records.e00200p + delta_wage
Expand Down