Add OBR-grounded TPI charts and fix transition path mapping#63
Open
nwoodruff-co wants to merge 5 commits intomainfrom
Open
Add OBR-grounded TPI charts and fix transition path mapping#63nwoodruff-co wants to merge 5 commits intomainfrom
nwoodruff-co wants to merge 5 commits intomainfrom
Conversation
- Fix map_transition_to_real_world: use period-0 anchor scale factor so baseline levels carry the full growth path rather than collapsing to a flat constant each period - Add scripts/run_tpi_and_export.py: runs SS+TPI for baseline and a 1pp basic rate reform, exports results to tpi_results.xlsx with optional pre-2026 ONS/OBR historical rows (light yellow) prepended to the baseline sheet - Add scripts/tpi_charts_plotly.py: single-page 2×3 chart showing five variables as % of GDP and GDP in £bn; baseline = OBR Nov 2025 EFO outturn + forecast; reform = OBR baseline × TPI % change from model; dashed reform line only, grey dotted boundary at outturn/forecast split
Extend chart baseline back to 2000-01 by fetching ONS YBHA/NPQS/ABJQ calendar-year series and converting to fiscal years via the existing _fy_from_calendar() helper. OBR table 1.4/1.2 data takes priority from 2008-09 onwards; ONS rows are only prepended for earlier years. Also extend hardcoded _fy_tax_revenue() back to 2000-01 using HMRC outturn data, and update x-axis range to use HIST_START_FY constant.
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.
Summary
map_transition_to_real_world: was using a per-period scale factor (gdp_bn / baseline.Y[t]) which cancelled out all growth, leaving baseline levels flat at the ONS anchor value every year. Fixed to use a period-0 anchor so the full model growth/transition path propagates through to £bn levels.scripts/run_tpi_and_export.py: runs baseline + reform SS+TPI (1pp basic rate increase from 2027), exports totpi_results.xlsxwith three sheets (baseline levels, reform levels, reform changes). Optionally prepends 2016–2025 ONS/OBR historical rows (highlighted in yellow) to the baseline sheet.scripts/tpi_charts_plotly.py: generates a single-page 2×3 interactive chart grounded in OBR data. Five panels show variables as % of GDP; GDP panel shows £bn. Baseline = OBR Nov 2025 EFO outturn (to 2024) + forecast (2025–2030). Reform = OBR baseline × TPI % change from model. Reform shown as dashed line only; baseline is one continuous solid line throughout.Test plan
uv run python scripts/run_tpi_and_export.py— should producetpi_results.xlsxwith non-flat baseline levelsuv run python scripts/tpi_charts_plotly.py— should producescripts/tpi_charts.html