Fix payroll tax revenue double-counted in aggregates.revenue (Issue #1199) - #1204
Merged
jdebacker merged 1 commit intoAug 17, 2026
Merged
Conversation
Fixes PSLmodels#1199. Each household's income_payroll_tax_liab already includes T_P = tau_payroll * labor_income, so payroll revenue is inside iit_payroll_tax_revenue. PR PSLmodels#1184 then added get_payroll_tax_revenue (the same amount re-derived from the aggregate wage bill) into that total again when tau_payroll != 0, overstating revenue so the government over-spent and the steady-state resource constraint failed for any model with a nonzero tau_payroll (OG-USA was fine only because its tau_payroll is 0). Removes the erroneous addition. get_payroll_tax_revenue still provides the income-vs-payroll reporting split (iit_revenue = iit_payroll_tax_revenue - payroll_tax_revenue), which is unchanged. Restores the test_revenue golden values to their pre-PSLmodels#1184 amounts (verified identical to the values from before the double-count was introduced).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1204 +/- ##
==========================================
- Coverage 72.74% 72.73% -0.01%
==========================================
Files 22 22
Lines 5768 5766 -2
==========================================
- Hits 4196 4194 -2
Misses 1572 1572
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
jdebacker
approved these changes
Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1199. Thanks @marcelolafleur for the precise diagnosis — this is a regression I introduced in #1184, so cleaning it up.
The bug. Each household's
income_payroll_tax_liabalready includesT_P = tau_payroll * labor_income(intax.income_tax_liab), so payroll revenue is fully insideiit_payroll_tax_revenue. In #1184 I then addedget_payroll_tax_revenue— the same take, re-derived from the aggregate wage billtau_payroll * w * L— back into that same total whenevertau_payroll != 0. The two are the same money, so revenue was overstated by the payroll take, the government spent it, and the steady-state resource constraint failed. Any model with a nonzerotau_payrollbroke (OG-PHL); OG-USA was unaffected only because itstau_payrollis 0.The fix. Remove the erroneous
if np.any(p.tau_payroll != 0): iit_payroll_tax_revenue += payroll_tax_revenue.iit_payroll_tax_revenuestays what the line above builds (household bills, payroll already inside).get_payroll_tax_revenueis kept — it still provides the income-vs-payroll reporting split (iit_revenue = iit_payroll_tax_revenue - payroll_tax_revenue), which is the genuinely useful part of #1184 and is unchanged.I also restored the
test_revenuegolden values, which #1184 had inflated to match the double-count. I pulled them from the commit just before #1184's second commit and confirmed they are identical, so this returns the totals to exactly the pre-#1184 (correct) amounts.Testing
pytest tests/test_aggregates.py→ 43 passed;test_revenue(including thetau_payroll = 0.5cases) andtest_get_payroll_tax_revenueboth green.ruff format --check ./ruff check .clean.