Skip to content

Add OBR-grounded TPI charts and fix transition path mapping#63

Open
nwoodruff-co wants to merge 5 commits intomainfrom
obr-grounded-tpi-charts
Open

Add OBR-grounded TPI charts and fix transition path mapping#63
nwoodruff-co wants to merge 5 commits intomainfrom
obr-grounded-tpi-charts

Conversation

@nwoodruff-co
Copy link
Collaborator

Summary

  • Fix 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.
  • Add scripts/run_tpi_and_export.py: runs baseline + reform SS+TPI (1pp basic rate increase from 2027), exports to tpi_results.xlsx with three sheets (baseline levels, reform levels, reform changes). Optionally prepends 2016–2025 ONS/OBR historical rows (highlighted in yellow) to the baseline sheet.
  • Add 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

  • Run uv run python scripts/run_tpi_and_export.py — should produce tpi_results.xlsx with non-flat baseline levels
  • Run uv run python scripts/tpi_charts_plotly.py — should produce scripts/tpi_charts.html
  • Verify baseline GDP in 2026 ≈ £2,891bn and grows thereafter
  • Verify reform line diverges from baseline only from 2027 onwards

- 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.
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