Skip to content

Commit

Permalink
Merge pull request #260 from PSLmodels/zero-agi-test
Browse files Browse the repository at this point in the history
Add test of weighted number of tax units with zero AGI
  • Loading branch information
martinholmer authored Oct 26, 2024
2 parents 9d9d53d + 940a43b commit 89f7404
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,19 @@ def compare(name, act, exp, tol):
wght = sim.array("s006")
agi = sim.array("c00100")
itax = sim.array("iitax")
mars = sim.array("MARS")
# check various income tax statistics
compare("wght_sum", wght.sum(), 184e6, 0.01)
hiagi = agi >= 1e6
compare("wght_sum_hiagi", (wght * hiagi).sum(), 0.875e6, 0.01)
compare("wght_itax_sum", (wght * itax).sum(), 1591e9, 0.01)
compare("wght_itax_sum_hiagi", ((wght * itax) * hiagi).sum(), 902e9, 0.01)
# count weighted number of tax units with zero agi by filing status
agi0 = agi == 0
compare("wght_sum_agi0_fs0", (wght * agi0).sum(), 16.22e6, 0.01)
mars1 = mars == 1
compare("wght_sum_agi0_fs1", (wght * mars1 * agi0).sum(), 12.01e6, 0.01)
mars2 = mars == 2
compare("wght_sum_agi0_fs2", (wght * mars2 * agi0).sum(), 2.00e6, 0.01)
mars4 = mars == 4
compare("wght_sum_agi0_fs4", (wght * mars4 * agi0).sum(), 1.53e6, 0.01)

0 comments on commit 89f7404

Please sign in to comment.