Skip to content

Fix JCT tax expenditure target handling in calibration#648

Closed
MaxGhenis wants to merge 2 commits into
mainfrom
codex/pr639
Closed

Fix JCT tax expenditure target handling in calibration#648
MaxGhenis wants to merge 2 commits into
mainfrom
codex/pr639

Conversation

@MaxGhenis
Copy link
Copy Markdown
Contributor

Summary

This fixes the JCT target concept mismatch described in Fixes #646.

Changes:

  • load national JCT deduction and QBI rows as reform-based tax expenditure targets instead of baseline filer/itemizer targets
  • carry reform_id through target_overview, target querying, matrix building, and staging validation
  • compare reform targets to repeal-based income_tax deltas rather than raw deduction totals
  • deactivate stale baseline rows from older ETL runs and ignore inactive rows in matrix target selection
  • add regression coverage for reform_id passthrough and reform target querying/naming

Why

JCT publishes tax expenditures, not deduction aggregates. The old path mixed SOI-style deduction totals with JCT revenue-loss targets, which materially distorted calibration for variables like salt_deduction.

Validation

  • python3 -m py_compile on all edited files
  • SQLite smoke test of the updated target_overview and best-period target query logic

Environment limitation

I could not run the repo's normal pytest path in this workspace because the available environments are broken on torch and missing sqlmodel in the fallback Python.

baogorek and others added 2 commits March 26, 2026 11:06
SOI targets for SALT, real estate taxes, and medical expense deduction
are reported only for the ~10% of filers who itemize, but the existing
`variable > 0` constraint captures everyone with economic exposure
(~80-90% of filers). This mismatch causes massive count and dollar
overestimates. Adding `tax_unit_itemizes == 1` fixes the population
alignment.

Changes:
- etl_irs_soi.py: For salt, real_estate_taxes, and
  medical_expense_deduction, append a `tax_unit_itemizes == 1`
  constraint to child strata in the generic target loop.
- etl_national_targets.py: Split JCT itemized deduction targets
  (salt_deduction, medical_expense_deduction, charitable_deduction,
  interest_deduction) into a separate itemizer_targets list loaded
  into a new "United States - Itemizing Tax Filers" stratum with
  both filer and itemizer constraints. QBI deduction remains in the
  plain filer stratum (above-the-line).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@MaxGhenis
Copy link
Copy Markdown
Contributor Author

Superseded by the updated #639, which now contains the same fix on the original PR branch.

@MaxGhenis MaxGhenis closed this Mar 27, 2026
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.

Treat JCT deduction targets as tax expenditures, not deduction aggregates

2 participants