Skip to content

Remove Additional Medicare Tax from fiitax to match NBER taxsimtest#963

Merged
PavelMakarchuk merged 2 commits into
mainfrom
remove-addmed-from-fiitax
Jun 4, 2026
Merged

Remove Additional Medicare Tax from fiitax to match NBER taxsimtest#963
PavelMakarchuk merged 2 commits into
mainfrom
remove-addmed-from-fiitax

Conversation

@PavelMakarchuk

Copy link
Copy Markdown
Collaborator

Summary

Stop adding additional_medicare_tax to the fiitax output. NBER TAXSIM-35 (taxsimtest) reports the Additional Medicare Tax (Form 8959) in a separate addmed column rather than rolling it into regular income tax — matching Form 1040 Line 23 / Schedule 2 Line 11. PE's income_tax (which already includes NIIT) is the correct match for TAXSIM's fiitax.

Why

This was the dominant remaining federal mismatch on the eCPS comparison after #961 / #962. On the n=2000 TY 2025 sample:

  • 95% of the residual federal $$ off ($412K of $432K) was traceable to records above the AddMed threshold.
  • The correlation between |fed_diff| and 0.9% × (medicare_wages − threshold) was 0.997 — almost a perfect fit, indicating a single source.
  • Every top-12 federal-miss record sat right on 3.8% × $... = $... for AddMed.

Verified by probing the live binary used by our compare flow:

$ cat single_500k.csv | resources/taxsimtest/taxsimtest-osx.exe
fiitax=140264.75
addmed=2355.75
v28=140264.75    # income tax before NIIT / AddMed

fiitax here is just v28 (income tax only). AddMed comes out separately. PE was reporting fiitax = income_tax + additional_medicare_tax, hence the consistent ~AddMed-sized overshoot.

Statute / form anchors

  • IRC § 3101(b)(2): 0.9% Additional Medicare Tax on wages above $200K single / $250K MFJ / $125K MFS.
  • IRC § 1401(b)(2): same 0.9% applied to net SE earnings above same thresholds.
  • Form 8959: AddMed computation worksheet.
  • Form 1040 Line 23 / Schedule 2 Line 11: AddMed reported as "Other Taxes", separate from Line 16 regular income tax.

Changes

  1. policyengine_runner.py: drop the AddMed add-on from both the fiitax output assembly and the frate marginal-rate calculation (which had to mirror the fiitax definition, including a comment that referenced the now-removed addition).
  2. tests/test_addmed_excluded_from_fiitax.py: two pinning tests using NBER taxsimtest smoke values as targets:
    • Single $500K wages 2024 → fiitax ≈ $140,265 ±$200
    • MFJ $1M wages 2024 → fiitax ≈ $285,321 ±$300
      Both targets are tight enough that adding back AddMed (~$2,700 / ~$6,000) would break them cleanly.
  3. changelog.d/remove-addmed-from-fiitax.fixed.md.

eCPS n=2000 TY 2025 (non-S-corp, --disable-salt --assume-w2-wages)

Metric Before This PR Δ
Federal $$ off $432,768 $40,730 −$392K (−90.6%)
Federal $15 match 93.6% 97.3% +3.7pp
Federal 1%-AGI match 99.9% 99.9% (already saturated)
State $$ off $121,738 $121,738 (unchanged, expected)
>$1M bucket $$ off $325,353 $17,971 −$307K (−94%)

Per-bucket federal $$ off

Bucket n Before This PR
≤$25K 560 $5 $5
$25–50K 390 $26 $26
$50–100K 374 $21,645 $12,400
$100–250K 293 $3,974 $1,918
$250K–1M 74 $81,765 $8,410
>$1M 36 $325,353 $17,971

Test plan

  • Both new tests pass (test_single_500k_fiitax_excludes_addmed, test_mfj_1m_fiitax_excludes_addmed)
  • Full pytest tests/ passes
  • eCPS n=2000 TY 2025 confirms 90.6% federal $$ reduction with no per-bucket regression
  • Existing test_otherprop_niit.py::test_otherprop_does_not_trigger_qbid continues to hold (the otherprop-NIIT target $353,188 for the synthetic probe matches taxsimtest because the synthetic record has no wages → no AddMed component)

NBER TAXSIM-35 (taxsimtest) reports the Additional Medicare Tax
(Form 8959) in a separate `addmed` column per Form 1040 Line 23 /
Schedule 2 Line 11, not as part of regular income tax. PE was
adding it to `fiitax`, which caused PE to overshoot TAXSIM by
exactly the AddMed amount on every record above the $200K single
/ $250K MFJ threshold.

On the eCPS n=2000 TY 2025 sample this represented ~$412K (95%)
of the residual federal mismatch with correlation 0.997 between
the actual diff and 0.9% × (wages − threshold). Per IRC § 3101(b)(2)
and § 1401(b)(2), the 0.9% AddMed is statutorily distinct from
the regular income tax bracket calculation.

PE's `income_tax` already includes NIIT via
`income_tax_before_refundable_credits`; that is the correct match
for TAXSIM's `fiitax`. AddMed continues to flow out through the
`v44` output column (`employee_medicare_tax + additional_medicare_tax`).
The `frate` marginal-rate calculation mirrors the same fiitax
definition, so it also drops AddMed to avoid a spurious 0.9% step
above threshold.

eCPS n=2000 TY 2025 (non-S-corp):
  Federal $$ off:    $432,768 → $40,730  (−90.6%)
  Federal $15 match:    93.6% → 97.3%
  >$1M bucket $$ off:  $325K → $18K (−94%)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
policyengine-taxsim Ready Ready Preview, Comment Jun 4, 2026 9:01pm

Request Review

The pre-existing `test_fiitax_includes_additional_medicare_tax_when_precomputed`
guarded the removed behavior and was failing across the CI matrix.
Rewrite it to assert the inverse: `fiitax` is populated from
`income_tax` alone, and `additional_medicare_tax` is never invoked
during fiitax assembly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@PavelMakarchuk PavelMakarchuk merged commit 4d0554d into main Jun 4, 2026
12 checks passed
@PavelMakarchuk PavelMakarchuk deleted the remove-addmed-from-fiitax branch June 4, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant