Program statistics count every unchanged tax unit as both a winner and a loser
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
Read src/policyengine/outputs/program_statistics.py, especially the ChangeAggregate thresholds in ProgramStatistics.run(). Add or update a test covering an unchanged tax and check that it yields zero winners and zero losers. The issue is done when tax winner and loser thresholds match the suggested directions and the regression test passes.
Written by the indexing model from the issue text.
Description
Filed by Claude Code for Max.
ProgramStatistics.run() inverts the winners and losers thresholds for taxes, so every unit whose tax doesn't change counts as both a winner and a loser.
src/policyengine/outputs/program_statistics.py on main (lines 85–103; the same in 6.20.3):
winners = ChangeAggregate(..., change_geq=0.01 if not self.is_tax else -0.01)
losers = ChangeAggregate(..., change_leq=-0.01 if not self.is_tax else 0.01)
For a tax, change >= -0.01 keeps every unit whose tax stayed the same or rose, and change <= 0.01 keeps every unit whose tax stayed the same or fell.
What it prints. With 6.20.3 and the default US dataset, pe.us.economic_impact_analysis for a single filer standard deduction of $30,950 in 2026 gives these rows:
| program_name | change | winners | losers |
|---|---|---|---|
| income_tax | -9.149107e+10 | 1.159564e+08 | 1.644485e+08 |
| employee_payroll_tax | 0 | 1.653825e+08 | 1.653825e+08 |
The payroll tax doesn't change, yet every unit counts as both a winner and a loser. Income tax falls, yet more units count as losers than winners. The UK example on policyengine.org/uk/python shows the same pattern for national_insurance: 7.120972e+07 winners and 7.120972e+07 losers at zero change.
Suggested fix. For a tax, count winners as change <= -0.01 and losers as change >= 0.01. Add a test in which an unchanged tax yields zero winners and zero losers.
PolicyEngine/household-api-docs#28 stops showing these two columns in the US examples on /us/python until a fix ships.
🤖 Generated with Claude Code
- Dominant language
- Python
- Stars
- 10
- Forks
- 10
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 16
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PolicyEngine/policyengine.py
-
Model version publishes the new UK firm entity as a personPossibly taken @vahid-ahmadi claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PolicyEngine/policyengine.py#764 ·
Maintainers usually reply within 1 day
-
Raise the simulation cache memory warning to 16 GiBPossibly taken @anth-volk claimed this 57 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
PolicyEngine/policyengine.py#549 ·
Maintainers usually reply within 1 day
-
README population quickstart still teaches enhanced_frs_2023_24Possibly taken @vahid-ahmadi claimed this 35 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PolicyEngine/policyengine.py#473 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
PolicyEngine/policyengine.py#436 · 1 comment ·
Maintainers usually reply within 1 day
-
Certify populace-uk as the UK certified defaultMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PolicyEngine/policyengine.py#408 ·
Maintainers usually reply within 1 day
All issues in PolicyEngine/policyengine.py
Similar issues
-
claude-subscription-directsdk: tool calls with raw control characters in string values are droppedOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NousResearch/hermes-official-plugins#538 ·
Maintainers usually reply within 3 days
-
bug(qdiffusion): EnergyModel.score_visible_logits computes biased visible/hidden on-ratios when solver returns variable solution counts per candidatePossibly taken @houzhongyu claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
qboson/kaiwu-pytorch-plugin#2133 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
MakazhanAlpamys/Soup#3415 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days