Repository navigation
Add a California breakdown of the labor-to-capital shift - #49
Merged
Merged
Conversation
analysis/california_shift.py runs the sweep's shift and fiscal accounting on the installed PolicyEngine bundle, one fresh microsimulation per level, and records what the sweep payload leaves out for California: its employee SDI contribution, its change by within-state market-income group, and federal net revenue (the all-government change less every state's net change). analysis/california_chart.py draws California against all other states from the site's sweep payload or from a run. The tests state the accounting's invariants and check them with Hypothesis. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
analysis/california_summary.py prints each level's California, other-state and federal changes, the federal split into income tax, payroll, credits and benefits, California's labor and capital flows and group rows, and the drift from src/data/shiftSweepData.json. A differential test checks that the federal split plus the states' lines equals fiscal.net_fiscal_impact's total. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The sweep scales every positive capital-income dollar in the country by one factor, so a state whose share of national capital income exceeds its share of labor income gains market income from other states. The variant gives each state's freed labor income to that state's own capital holders, so each state's market income stays fixed and its revenue change reflects only the movement of income within the state. california_shift runs it at 10% and 50% by default (--within-state-levels), and california_summary splits California's gain into the within-state part and the part from income moving in from other states. Tests: per-state conservation, positive-only scaling, refusal for a state with labor but no capital, a hand-checked example, a closed-form match to the national shift when every record sits in one state, a differential match to labor_capital_shift._apply_shift (when policyengine_us is installed), and a wiring test of run() with faked PolicyEngine calls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mulation year Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Output of `python -m analysis.california_shift` on policyengine 6.16.0 (policyengine-us 2.2.1, the 2026-09-15 Microcosm national release) for 2026: the national allocation at 10, 20, 50 and 100 percent and the within-state allocation at 10 and 50 percent. Aggregates only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The all-other-states path depends on where new capital income lands, so `--california-only` charts California with and without SDI alone. End markers no longer clip at 0% and 100%, and the note says the shift holds national income fixed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under the national allocation California's market income falls, so its cross-state part comes from income leaving the state, not arriving. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
marked this pull request as ready for review
November 7, 2026 23:17
…ns them The note said the shift adds capital income "in proportion to existing holdings"; `_apply_shift` scales the interest, dividends, capital gains and rent people already receive. The subtitle's "state-funded benefits" read as every state program, but California's net subtracts only its refundable credits and the nine programs `household_state_benefits` lists for it, none of them Medi-Cal or CalWORKs; the California-only chart now says so. The x-axis label drops a reduced passive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e comment "Selected" read as a reduced passive in the chart subtitle. The comment above CALIFORNIA_MEASURE_NOTE now names fiscal.state_revenue_delta, which subtracts the refundable credits and state benefits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The sweep's state measure leaves out Medi-Cal and CalWORKs. Household net income excludes health benefits (include_health_benefits_in_net_income is false), so Medicaid, CHIP, the Medicare Savings Programs and ACA premium tax credits sit in no government's total, and tanf sits in household_benefits but in no state's line, so the sweep books CalWORKs as federal. The new *_with_health_tanf fields charge each state its share of Medicaid, CHIP and MSP costs under policyengine-us's federal matching rules (state_benefit_cost), the whole cost of coverage it funds alone for people whose immigration status rules out federal matching (policyengine-us books a federal share for them), its own health subsidies and its whole TANF change, since the federal TANF grant is fixed. The all-government total adds every program in household_health_benefits, and federal is what the states leave. The run refuses a model whose health lists differ from the ones classified here, and checks that the federal and state shares add up to the costs. Property tests cover conservation of health spending and the federal-plus- states identity; differential tests check the immigration-status mirror and the state-only move against policyengine-us 2.2.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e tax household_state_tax_before_refundable_credits adds state income tax and use tax, and California's income tax includes the 1% tax on taxable income above $1 million (ca_mental_health_services_tax), whose revenue funds behavioral health services rather than the General Fund. The California rows now report both, so a reader can see how much of the change each fund receives. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
_state_only_coverage moved every federal share policyengine-us books for people whose immigration status rules out federal matching. That included CHIP coverage through the From-Conception-to-End-of-Pregnancy option, which policyengine-us gives pregnant people regardless of status (is_chip_fcep_eligible_person) and which federal CHIP funds match, since the unborn child is the beneficiary (42 CFR 457.10). In California every CHIP enrollee in the model is an FCEP enrollee, as the state's separate CHIP child limit is -inf. _state_only_federal_share now leaves the CHIP share in place for chip_category PREGNANT_FCEP. New tests: an example, a property test (nothing moves for federally eligible people, never more than the booked share, never the FCEP CHIP share), and a policyengine-us check that an undocumented pregnant woman in Texas keeps her federal CHIP match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… off the federal line This addresses the round-1 review of #49: - Each shifted branch takes the baseline's medicaid_slcsp_state_denominator, so state Medicaid totals move with enrollment. Outside reform mode, policyengine-us spreads each state's spending over the branch's own enrollees, which holds every state's total fixed. - Federal net revenue leaves out state payroll taxes (employee and employer) and local taxes, which the all-government total counts but no state line holds. federal_net_published_definition_change_b keeps the site's definition for the drift comparison. The summary's federal split adds the additional Medicare tax and FUTA and reports state payroll and local lines. - A state whose line already holds its TANF program (Massachusetts's TAFDC in policyengine-us 2.2.1) pays it once, and the all-government total with health counts it once. - Healthier Oregon's cost drops for people policyengine-us also enrolls in Medicaid. - The five state premium subsidies that healthcare_benefit_value counts (CT, MA, NJ, VT, WA) join state health spending. The classification check reads healthcare_benefit_value and accepts household_health_benefits with or without them, as later policyengine-us releases list them there. - CHIP's unborn-child carve-out keys on is_chip_fcep_eligible_person and chip_enrolled, and the docstring restates the emergency-Medicaid caveat. - The chart's title follows the sign of California's change, its subtitle turns general when other states appear, and small ranges get decimal ticks. Tests: - On a four-household PolicyEngine dataset, a branch's Medicaid total stays fixed on its own and rises with enrollment at the baseline price. - Property tests cover the federal split's completeness, the TANF charge, and the all-government identity with state payroll and local taxes. - Each fix also has an example test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es TANF - The output now holds the full rerun on policyengine 6.16.0 from c916f7f's code: Medicaid at the baseline price, the federal line without state payroll and local taxes, and the *_with_health_tanf fields. Its description field takes the new RUN_DESCRIPTION; no other field differs from the run. - The module docstring, run description and summary now say that the shift sets employment_income and self_employment_income on each branch, so programs that read the *_before_lsr inputs (the default TANF earned-income list, and Massachusetts's, Montana's and South Carolina's) see pre-shift earnings. California's CalWORKs list reads the shifted variables. - A new test ties the five unlisted state subsidies to the frame, using a Massachusetts adult on ConnectorCare. The Medicaid pricing test now asserts positive costs. - Comments: wrap one long docstring line, and stop saying every state pays insurers, which Connecticut's documentation doesn't state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Those states' TANF responds to the added capital income and misses only the wage cut, and the study measure's federal lines miss it too. The run description in the output changes to match; no number moves. The chart prints negatives as −$243B and moves the legend clear of the lines when the values run further below zero than above. The state-only Medi-Cal docstring says the line doesn't estimate California's actual cost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The new Hypothesis test sets deadline=None like every other one in the file, because its first example imports matplotlib when it runs alone. The health list check now has tests for a list that also holds the five state subsidies: a new program and a dropped program both refuse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 of 11 tasks
This branch was successfully deployed
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.
This adds a California breakdown of the 2026 labor-to-capital shift, a within-state variant of the shift, an accounting that counts health spending and TANF, and a rerun of all of it on the current PolicyEngine bundle: policyengine 6.16.0, policyengine-us 2.2.1 and the 2026-09-15 Microcosm national release. It leaves the site alone.
What it adds
analysis/california_shift.pyruns the sweep's shift (labor_capital_shift._apply_shift) and fiscal accounting (fiscal.revenue_components,fiscal.state_revenue_components) on the installed bundle, with one fresh microsimulation per level. For California it records:household_state_tax_before_refundable_creditsholds state income tax and use tax only);federal_net_published_definition_change_bkeeps the site's definition (all governments less the states), and the drift table below uses it.*_with_health_tanffields, adds what the sweep's state measure leaves out. Household net income excludes health benefits (gov.simulation.include_health_benefits_in_net_incomeis false), so Medicaid, CHIP, the Medicare Savings Programs, ACA premium tax credits and state premium subsidies sit in no government's total, andtanfsits inhousehold_benefitsbut in no state's line, so the sweep books it federal. The new fields charge each state:state_benefit_cost);healthcare_benefit_value's list (for California, the Covered California premium subsidy);healthcare_benefit_valueand counts TANF once.medicaid_slcsp_state_denominator), so on its own aget_branchbranch that adds enrollees cuts every enrollee's cost and keeps the state's total. Each shifted branch here takes the baseline's denominator, so a new enrollee adds cost._apply_within_state_shift,--within-state-levels, default 10% and 50%). The sweep scales every positive capital-income dollar in the country by one factor, so a state whose share of national capital income exceeds its share of labor income gains market income from other states. The variant gives each state's freed labor income to that state's own capital holders, so each state's market income stays fixed.analysis/california_summary.pyprints a run against the published sweep: California with and without SDI, both measures, the federal split, groups, drift from the site, and California's gain split into income moving within the state and income moving between states.analysis/california_chart.pydraws California with and without SDI, against all other states unless--california-onlydrops that line, on either measure. A run defaults to health and TANF; the sweep holds only the study's measure.analysis/outputs/california_shift_pe6.16.0.json, the rerun (state and group aggregates only).Results (policyengine-us 2.2.1, 2026)
National allocation with health spending and TANF:
California's parts at each level (the net also holds the use tax, whose change stays under $0.02B):
California comes out ahead at every level. Its top 1% hold 6.3% of the state's labor income and 39.8% of its capital income. At 10%, that group pays $7.92B more state income tax, the 90th to 99th percentile pays $2.30B more, and the 50th to 90th percentile pays $4.40B less. Medi-Cal, CalWORKs and the premium subsidy take $2.94B of the gain at 10%. SDI contributions fall $2.25B at 10%, so counting them turns the gain into −$0.15B.
This run moves $0.07B of federal Medi-Cal share to California at baseline, for people whose status rules out federal matching, and that amount changes by +$0.00B at 10% and +$0.65B at 100%. The line doesn't estimate California's actual state-only Medi-Cal cost. Microcosm treats anyone who reports Medicaid in the CPS as documented, and from 2026 policyengine-us's enrollment freeze keeps undocumented adults without existing coverage out at every income (
is_ca_medicaid_immigration_status_eligible), so only the groups the freeze exempts can enter the line as incomes fall.National allocation on the study's measure (no health or TANF):
Within-state allocation:
Under the national allocation, California's households give up $179.9B of labor income at 10% and receive $176.9B of capital income, so $3.1B of market income leaves the state. On the study's measure that costs California $0.35B of the $5.39B it collects when each state keeps its own income.
At every level the committed run agrees with itself: California's pipeline figure matches its household frame, the per-state sum matches the national state lines, and the within-state shift holds California's market income fixed.
Drift from the published sweep (policyengine 5.0.1, policyengine-us 1.764.6)
The study's measure, with federal on the site's definition:
The state figures barely move, and the federal loss shrinks by 5% to 14%. This PR neither diagnoses the federal drift nor refreshes the site's sweep.
Limits
employment_incomeandself_employment_incomeon each branch, so anything that reads their*_before_lsrinputs sees pre-shift earnings. policyengine-us's default TANF earned-income list reads those inputs, as do Massachusetts's, Montana's and South Carolina's lists, so those states' TANF benefits respond to the added capital income and not to the wage cut, and can fall. The TANF, other-states and all-government lines and the study measure's federal lines miss the response to the wage cut. SNAP's gross self-employment income reads those inputs too. California's CalWORKs list reads the shifted variables, so California's line holds the response. The published sweep's shift has the same limit, and the site refresh should decide whether to move it.medicaid_costspreads count federally matched emergency care for people federal law otherwise excludes (42 USC 1396b(v)), moving their whole federal share overstates the state's cost by an amount this accounting can't measure.or_healthier_oregon_costhas no enrollment test, and policyengine-us also enrolls Oregon's undocumented residents in Medicaid. This run drops the Healthier Oregon cost for those people, which affects Oregon only.tanfandhousehold_state_benefits, and leaves five state premium subsidies out ofhousehold_health_benefits. This run charges TAFDC once and counts the five subsidies. On main, Count MA TAFDC once in household benefits policyengine-us#9478 and Register the remaining five state premium programs in household_health_benefits policyengine-us#9514 change both lists, and the code handles either version.Invariants
Property-based (Hypothesis) and example tests in
analysis/tests/test_california_shift.py:_weighted_rankputs every household strictly inside (0, 1), and a household with a higher value always ranks higher.labor_capital_shift._apply_shiftand as the closed-form national shift.fiscal.net_fiscal_impact's total; the split leaves no residual, and its parts match policyengine-us's own aggregates.get_branchbranch keeps its state's Medicaid total fixed on its own, and at the baseline's denominator the total rises with enrollment while existing enrollees keep their cost.192 tests pass and 9 skip in a venv with matplotlib and Hypothesis and without PolicyEngine. With policyengine-us 2.2.1 installed, the nine tests that need it pass:
test_california_shift.pyruns 38 passed and 4 skipped (those four need matplotlib, which the first venv has), and all 14 tests intest_net_income_exclusions.pypass. Between the two venvs, every test runs.🤖 Generated with Claude Code