Program statistics count every unchanged tax unit as both a winner and a loser

オープン 初心者向け
#771 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
data

調査の方向性

src/policyengine/outputs/program_statistics.pyを読み、特にProgramStatistics.run()内のChangeAggregateのしきい値を確認してください。税額が変わらないケースを対象とするテストを追加または更新し、勝者と敗者がともに0になることを確認してください。税額の勝者と敗者のしきい値が提案された方向と一致し、回帰テストが通れば、issueは完了です。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Python
スター
10
フォーク
10
平均マージ
2日 2時間
マージ済み PR(30日)
16

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

PolicyEngine/policyengine.py のほかの issue

PolicyEngine/policyengine.py の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。