Skip to content

Make the case-level model the simulator's lever mechanism - #17

Merged
MaxGhenis merged 1 commit into
mainfrom
model-primary-app
Aug 7, 2026
Merged

MaxGhenis merged 1 commit into
mainfrom
model-primary-app

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

The app-side half of the model-primary pivot (data contract landed in #16). Every number a lever produces now comes from the case-level predictive model; the accounting mechanism is gone.

Removed — the four category checkboxes, the suppression-effectiveness dial, and scenarioErrors(), which scaled observed FY 2024 error dollars by finding category. No accounting-suppression path is reachable from the UI.

The lever is now the SMD scenario. Ticking "Adopt/Drop the standard medical deduction" (label follows the state's FY 2024 policy) applies the state's sparse SMD-flipped per-case parameters from model_scenarios.json and simulates both endpoints from the fitted model — same inverse-CDF draw engine, baseline vs patched parameters, levels anchored to the official rate. The control displays the exported paired-bootstrap delta and 95% interval (e.g. Colorado: −0.034pp, CI −0.077 to +0.004, 53 flipped cases) and says plainly it is an association from burden features adding +0.006 ROC AUC, not a causal estimate. Self-employment, heat-and-eat, and BBCE are absent because the export excludes them with reasons; the fine print links the machine-readable export.

Integrity checks in the browser. The scenario export is valid only against the exact model_data.json it pins; the app verifies that SHA-256 with crypto.subtle at load, plus schema, delta-direction, patch-index, monotonicity, and probability-range assertions. Any failure disables the scenario with the error displayed — no silent fallback.

Gates honored. AK, HI, ID, MN, SD, VI, WY (factor-adjusted level ratio outside [0.7, 1.4]) get a disabled control showing the reason and the state's own ratio. Shared links to gated states degrade to the observed view.

The no-scenario engine is unchanged: the observed QC resample, centered on the official rate. A persistent sampling-engine line states which mechanism produced what's on screen.

Verified in the browser (localhost, light + dark, desktop + mobile 375px, no console errors): scenario on/off for adopter (CO/GA) and non-adopter (WI) states with hint numbers matching analysis/MODEL_SCENARIOS.md rows exactly; gated WY disabled with ratio 0.41; deep links (?state=GA&smd=1&audits=300) restore state including model auto-load; legacy levers/eff/mode params ignored; all-53 national table computes; no horizontal overflow at 375px.

🤖 Generated with Claude Code

Remove the accounting-bound levers entirely: the four category
checkboxes, the suppression-effectiveness dial, and scenarioErrors(),
which scaled observed error dollars by finding category. No
accounting-suppression path remains reachable from the UI.

The one policy scenario is now the standard medical deduction, driven
by model_scenarios.json: ticking it applies the state's sparse
SMD-flipped per-case parameters (deviation probability and nine
quantiles) and simulates both endpoints from the fitted model, levels
anchored to the official rate. The control shows the exported
paired-bootstrap delta and 95% interval and states it is an
association, not a causal estimate. The artifact's base-model SHA-256
pin is verified in the browser before use; integrity failures disable
the scenario with the error shown, never a silent fallback.

Seven jurisdictions outside the [0.7, 1.4] factor-adjusted level-ratio
gate get a disabled control with the reason and their ratio. The
no-scenario engine remains the observed QC resample, labeled as such
by a persistent sampling-engine line.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis merged commit dee3ff4 into main Aug 7, 2026
1 check passed
@MaxGhenis
MaxGhenis deleted the model-primary-app branch August 7, 2026 20:57
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