diff --git a/lib/slideshows.ts b/lib/slideshows.ts index 15a7f6ea..ca94f69f 100644 --- a/lib/slideshows.ts +++ b/lib/slideshows.ts @@ -34,8 +34,10 @@ import { autumnBudget2026Config } from "@/slideshows/autumn-budget-2026/config"; import { prop40Webinar2026Config } from "@/slideshows/prop40-webinar-2026/config"; import { appam2026Config } from "@/slideshows/appam-2026/config"; import { studentDebt2026Config } from "@/slideshows/student-debt-2026/config"; +import { nef2026Config } from "@/slideshows/nef-2026/config"; export const slideshows: SlideshowConfig[] = [ + nef2026Config, bist2026Config, appam2026Config, prop40Webinar2026Config, diff --git a/slideshows/nef-2026/README.md b/slideshows/nef-2026/README.md new file mode 100644 index 00000000..c96d855c --- /dev/null +++ b/slideshows/nef-2026/README.md @@ -0,0 +1,145 @@ +# New Economics Foundation meeting, November 2026 + +24 slides at `/slides/nef-2026`, for a meeting with the New Economics +Foundation (NEF) on working together on the OBR macroeconomic model. The deck is +public. Slide 17 embeds the in-development macro site, and slide 19 the +unpublished AI study ("AI and the UK economy: Beyond the forecast", a public +Vercel preview; provisional) +(policyengine-macro.vercel.app) live; the site allows this deck's origins to +frame it (PolicyEngine/macro#276). The exact meeting date isn't fixed, so `config.ts` uses +`2026-11-01`, which renders as "November 2026"; change it, and the footer, +once the date is set. + +Five parts, after a title and an agenda. Each part opens with a section slide, +and every slide's header carries a tracker of the five parts: + +1. The OBR model in Python (slides 3–7): what the OBR publishes and what we + built, layer by layer; the model's 12 modules in three groups, and how + they connect; Thibault's review checked against the code; how our build runs, with three example equations +2. How well it fits (slide 8): anchored and free-running, on one slide, with no divider +3. Policy scenarios and limits (slides 9–14): results against the OBR's + published multipliers, income tax, investment, Bank Rate, and the known + limits and whose they are +4. The macro platform (slides 15–20): the seven models, the site live, using + it from Claude, an example in use (the unpublished AI study), and one reform taken from the + microsimulation to GDP. Every slide of this part is marked "Preview, not + yet launched" +5. Working together (slides 21–23): collaboration areas and questions for NEF + +On the slides a simulated change is a "scenario"; `shock` stays in code +identifiers and in the notes where it is the argument's name. + +It follows PolicyEngine's July 2025 deck for NEF, which covered the +tax-benefit microsimulation (`NEF x PolicyEngine.pptx` in the private +`PolicyEngine/obr-presentation` repo, commit `f4f819a7`; it isn't linked on +the slides). + +## Editing and presenting + +- `config.ts` controls the slide order, the build steps and meeting metadata. + Twelve slides reveal step by step when presenting (`builds`), 44 steps in + all; a PDF export shows each slide once, complete (`exportBuilds: 1`). + The viewer's counter shows the slide, not the step (`countSlides: true`, an + opt-in in `lib/types.ts`; other decks still count steps). +- `content.ts` holds every number on the slides, each with its source pinned + to a commit, plus the tables and lists. +- `slides/index.tsx` contains the slides and the deck's components (one list, + one card, one stat, one table style; every item takes a Tabler icon). Each + slide is one composition: nothing sits in a separate strip or footnote row + under it, and detail that doesn't fit goes to the speaker notes. The `agenda` list there drives the agenda slide, the + section slides and the header tracker. One slide points at another by + number (`incomeTaxSlideNumber`): update it if + the order in `config.ts` changes. +- `slides/deck.module.css` sizes the slide body in em of a base that follows + the viewport (the smaller of its height and width), and scales the header + (tracker, title, subtitle) with the viewport too, so a slide keeps its + proportions at 1920x1080, 1440x810 and 1280x720; the 1920x1080 sizes are + the shared components' own. A + slide's `scale` enlarges a sparse body. +- `slides/BuildScope.tsx` puts the current build step on the slide body. An + element with `data-step="N"` stays hidden, keeping its place, until step N, + then animates in (`deck.module.css`); an export shows every step. The same + stylesheet holds the entrance stagger and the motion inside figures (bars + grow, marks slide along their track, the two hero numbers count up), all + off under `prefers-reduced-motion`. +- `slides/SiteEmbed.tsx` frames the live site, with buttons for its main + pages, Expand and New tab (copied from autumn-budget-2026's `DashboardEmbed`). +- `slides/figures.tsx` draws the multiplier dot plot, the income-tax path, + the Bank Rate bars and the module map (HTML, CSS and SVG, no chart + library), and renders the example equations with KaTeX. +- `module-links.json` holds the links between the model's modules, and + `module-links.py` is the script that counts them from the OBR's listing: + `python module-links.py /path/to/obr-macroeconomic-model module-links.json`. + For each pair of modules it counts the equations in the target module whose + right-hand side uses a variable the source module determines. The script + also defines the three groups the slide draws (demand: consumption, + investment and inventories, exports, imports, GDP and output; supply and + prices: labour market, prices and wages, North Sea oil; income and sectors: + income accounts, public sector, balance of payments, finance and balance + sheets) and counts the same thing between groups, an equation counting + once per source group. The slide shows the six group-to-group counts as + arrows, and four module-level links inside the demand group, dashed. +- `SPEAKER-NOTES.md` gives the presenter track, the detail behind each slide, + its sources (the slides carry no source line) and what not to claim. It + also holds the live-demo checklist and the next steps to propose, which + are no longer slides. + +Run `bun install --frozen-lockfile`, then +`bun dev`. Open +`http://localhost:3000/slides/nef-2026`. Arrow keys, Page Up and Page Down +(a clicker) move between slides. Export with +`bun run export nef-2026 /path/to/output.pdf`. + +## Evidence + +Checked on 19 November 2026: + +- `PolicyEngine/obr-macroeconomic-model` main + `0e44ec87681eba0a1f61d634875f5431ac2344c8`, after #70 (opt-in VAT price + pass-through and the capital-spending investment closure), #71 (household + taxes held on their data path), #72 (docs and caveats), #74 (the forecast + 16+ population on the EFO-implied path, so anchored unemployment is the + EFO's) and #75 (the government-consumption shock carries its cash cost, so + borrowing moves). Every OBR-model number comes from this repo: the README + limits table, `docs/calibration_scorecard.md`, `docs/demo.md`, + `results/demo_shocks.json` (model commit `a822045`, the #75 branch, Actions + run 44394699022; demo.md says to regenerate it after the merge) and + `results/site_figures.json`. The + module counts and links on slide 5 and the example equations on + slide 7 come from + the OBR's listing in that repo + (`obr_macro/_data/obr_model_code_october_2025.txt`) and what + `obr_macro/transpiler.py` reads and emits for it; `content.ts` records how + the listing's groups map to the 12 modules. +- `PolicyEngine/macro` main `2e5dffe7a2b35d189c8df60ff2012abbdb675367`, after + #275: the README model table, the model comparison + (`models/index.html`), the Use page (`connect/index.html`), and the tool counts + (28 `@mcp.tool` functions in `mcp_server.py`, 27 `@main.command` functions + in `cli.py`; the README's own count of 26 tools is stale). + +Where the two repos disagree, the model repo wins: at `2e5dffe7` the macro +site's OBR page still quotes the pre-#71 free-running GDP error (4.25%) and +calls capital spending dead without the #70 investment-closure route. On 19 +November the live site's OBR and OBR validation pages still showed the +pre-#74 figures (anchored 0.44%, unemployment drifting); slide 17's notes +warn the presenter. + +What the deck deliberately does not claim: + +- the free-running GDP error (4.24%) is not an OBR forecast error, and the + anchored error (0.24%) is not forecast skill; +- anchored unemployment matching the EFO is by construction, not a forecast: + no scenario moves unemployment; +- the held-add-factor forecast fit (0.63% GDP) is left off the slides: the + forecasting framework calls its GDP line "close to circular"; +- no DEFINE-UK results or multiplier: which one to headline is an open + decision; +- no result numbers on the Claude slide: it shows the steps and the tools; +- no poverty figures: the platform's population tool returns decile changes and + winners and losers, not poverty rates (slide 19 names poverty as something + the microsimulation itself reports, with no number); +- no views or plans attributed to Thibault. On slide 6 the line under each + headline point is the heading `docs/published_model_review.md` gives it + (H1, R1, V2). The three card titles are our short names for his headline + points; they are not from that write-up and have not been checked with + him. diff --git a/slideshows/nef-2026/SPEAKER-NOTES.md b/slideshows/nef-2026/SPEAKER-NOTES.md new file mode 100644 index 00000000..42e6c614 --- /dev/null +++ b/slideshows/nef-2026/SPEAKER-NOTES.md @@ -0,0 +1,716 @@ +# NEF presenter notes + +Meeting with the New Economics Foundation, November 2026. Presenters: Vahid +Ahmadi and Max Ghenis. Goal: show the open OBR model and the macro platform, +and agree where to work together. About 30 minutes plus discussion: 7 on part +1, 4 on part 2, 7 on part 3, 7 on part 4, 5 on part 5 (the live demo under slide 17 can stretch part 4). + +Every number below is in `content.ts`, with its source pinned to a commit. + +The slides carry no source line; each section below ends with its sources, +and `content.ts` pins every one to a commit. + +Builds: twelve slides reveal step by step when presenting (the count is in +each heading below; `builds` in `config.ts`). Each click moves one step, so +the deck has 44 steps for 23 slides. A PDF export shows every slide once, +complete. The viewer's counter counts slides, not steps. Motion is off under the reduced-motion setting. + +On the slides a simulated change is a "scenario"; in the code and below, the +argument is still `shock=`. + +## 1. Title + +## 2. Today + +Five parts. Say up front that the platform isn't launched, and that we'll be +direct about limits. + +## 3. Part 1: the OBR model in Python + +Section slide: say what the part covers in one sentence and move on. The tracker at the top of every slide shows the same five parts. + +## 4. What the OBR publishes, and what we built (3 steps) + +Three cards, one per layer, from the repo's roadmap; each click adds a card. +Every card reads top to bottom: what the OBR has, what we built, and the +number that belongs to that layer. + +1. The model: published, 372 equations as EViews code; all 372 transpiled. + The number is 372: the OBR's listing and variable list of 15 October 2025, + still the latest on obr.uk on 16 November 2026. +2. The engine: EViews; we have a Gauss-Seidel solver, closures and + add-factors, not the full engine, and no stochastic simulation. The number + is 355 ONS series, pulled 11 July 2026 with 8 recovered on 22 September: of + 261 endogenous variables the EFO doesn't publish, 199 had ONS codes. The + amber caveat: 82 of the 372 equations drop in at least one quarter of the + pinned reform solve because an input has no data; each is listed in the + code, or the solve raises. +3. The judgement: the forecasters' add-factors and off-model assumptions, not + published. We stand in for it, and label every stand-in. The number is the + October 2026 EFO (detailed forecast tables, 28 October 2026), the forecast + the baseline is anchored to. + +Terms glossed on this slide, where they first appear: closure (which variables +are solved and which are inputs), add-factor (an adjustment added to an +equation's result) and the Economic and Fiscal Outlook (EFO), the OBR's +twice-yearly forecast. Later slides say "EFO". The model names are spelled out +in the platform table, MAPE as "average error" on the fit slide, and MCP on +the Claude slide. + +Same equations, not the OBR's judgements. The three stand-ins in the third +card: + +- Anchoring: the add-factors are computed as EFO minus model, so the baseline + sits on the OBR's published forecast. The EFO stands in for the OBR's + unpublished judgement, and reforms are scored as deltas around it, so the + add-factors cancel. +- Three opt-in overlays in `run_reform`, each labelled as judgement, not model + dynamics: `published_conventions=True` (the OBR's published multipliers with + their taper), `monetary_conditioning=True` (the mortgage rate follows Bank + Rate at the listing's 0.9 pass-through) and `price_passthrough=True` (VAT + passes into CPI). +- Your own assumptions: change any input path (Bank Rate, trade, CPI) through + `run_reform`. + +Not on the slide: cost-of-capital constants (DB, DP, DV) are estimated from +statute and the EFO gilt path; COCU is a declared seed. Two large level +anchors (OSHH, GGVA) are documented in the README. Unpublished inputs are +estimated or seeded, and labelled as such. + +Sources: OBR model roadmap; OBR model README (limits table l.27–35, l.141); forecasting framework. + +## 5. The model's modules, and how they connect (5 steps) + +One map of the listing, built in five steps. Step 1 shows the 12 modules in +three groups. Steps 2 to 4 draw the arrows between the groups, one colour per +click: teal for what leaves demand (output), amber for what leaves supply and +prices, dark for what leaves income and sectors. Step 5 adds the grey dashed +links that don't reach GDP in the OBR's file. The key is inside the map. + +The modules follow the section headers in the OBR's own code file +(`obr_model_code_october_2025.txt`); the number on each tile is the count of +equations our parser reads under those headers, and they sum to 372. + +- GDP and output 33 (Group 16, 29, plus the market sector GVA satellite, 4); + consumption 5 (Group 1); investment and inventories 49 (Groups 2 and 3, 7 and + 42); labour market 17 (Group 4); exports 3 (Group 5); imports 15 (Group 6); + balance of payments 31 (Group 11); North Sea oil 5 (Group 8); prices and + wages 44 (Group 7); income accounts 42 (Group 15); public sector 59 (Groups + 9, 10 and 12: expenditure 15, receipts 13, totals 31); finance and balance + sheets 69 (Group 14, 5, plus Group 18: households 28, rest of world 23, + non-financial companies 13). +- The listing has no Group 13 or Group 17. +- The amber tags mark what the OBR's file takes as given, from the review + write-up: real GDP (G1), total investment (N1), export and import volumes + (R1), CPI, which has no live equation (G3), and most tax receipts (V1). These + are the points Thibault's review builds on, on the next slide. +- Example variables, no longer on the tiles: GDP and output GDPMPS, GVA, + MSGVA; consumption CONS, CDUR, PD; investment and inventories IBUS, COC, + DINV; labour market ET, ULFS, LFSUR; exports XNOG, RPRICE, XPS; imports + MNOG, MS, MPS; balance of payments TB, CB, NIPD; North Sea oil TDOIL, + PXOIL, NSGTP; prices and wages EARN, CPIX, RPI; income accounts HHDI, + RHHDI, FYEMP; public sector CGG, PSCR, CGNB; finance and balance sheets M4, + NFWPE, NIIP. + +The three groups are ours, for the slide (defined in `module-links.py`): + +- Demand, 105 equations: consumption, investment and inventories, exports, + imports, GDP and output. +- Supply and prices, 66: labour market, prices and wages, North Sea oil. +- Income and sectors, 201: income accounts, public sector, balance of + payments, finance and balance sheets. + +The arrows. For each pair of groups we count the equations in the target group +whose right-hand side uses a variable the source group determines (lags count, +commented-out lines don't; an equation counts once per source group). The +number on an arrow is that count, and its width follows it. Each label names +the largest module links inside the flow: + +- Demand → supply and prices, 19: "output → prices". GDP and output → prices + and wages is 16 of them. +- Supply and prices → demand, 21: "prices → spending". Prices and wages → + investment 6, consumption 5, imports 3; labour market → GDP and output 3. +- Demand → income and sectors, 32: "output → incomes, balance sheets". GDP and + output → finance and balance sheets 11, income accounts 5; investment → + public sector 4. +- Income and sectors → demand, 24: "government → output, imports". Public + sector → GDP and output 7, imports 5. Income accounts → consumption (real + household income into the consumption equations) is 2. +- Supply and prices → income and sectors, 9: "prices, jobs → incomes". Prices + and wages → income accounts 3; labour market → public sector 2, finance 2. +- Income and sectors → supply and prices, 22: "incomes, exchange rate → + prices". Income accounts → prices and wages 10; balance of payments → prices + and wages 8 (the exchange rate into costs and trade prices). + +Dashed, inside the demand group: consumption → GDP and output 2, investment +and inventories 3, exports 1, imports 1 (module-level counts). The spending +components feed total final expenditure (TFE, TFEPS; imports feed GDPMPS), but +in the OBR's file real GDP is an input and trade volumes are exogenous, so +they don't move GDP there. Our build opens the consumption one by making GDP +endogenous. One of investment's three is not an expenditure link (stock +appreciation into company profits, FYCPR). + +A count is the number of equations, not the size of an effect. +`module-links.py` computes both matrices from the listing and writes +`module-links.json`. + +Sources: the OBR's model code (`obr_model_code_october_2025.txt`); `module-links.py` and `module-links.json` in this folder; published-model review (G1, N1, R1, G3, V1). + +## 6. Thibault's review, checked against the code (4 steps) + +Steps 1 to 3 bring in his three headline points one at a time, each with our +check and its result; step 4 adds three errors in the published files, also +from his list, smaller, below. The line under each card title is the heading +`docs/published_model_review.md` gives the point (H1, R1, V2), in place of a +paraphrase of ours; the header says "as our write-up records them". The card +titles are our short names for his three headline points and are not in the +write-up: ask him to correct them if they don't match. + +- Thibault is in the room: invite him to introduce his findings, and to + correct anything on the slide. It's his work. +- He read the OBR's published EViews code and variable list in September 2026 + and sent a list of 53 points (his ratings: 6 High, 25 Mid, 22 Low). +- His three headline points: no distributional effect of fiscal policy, total + imports fixed, public debt interest fixed. +- We checked each against the published code and in our Python build (written + up in `docs/published_model_review.md`, entries H1, R1, V2). All three hold; + the write-up's verdict on each is "true but openly documented". +- Distribution (H1): the consumption equation has more than income in it + (unemployment, house prices, a rate term and wealth), but every term is an + aggregate. There is no household split, so a revenue-neutral transfer does + nothing. +- Trade (R1): exports and imports never appear on the left-hand side of an + equation; the exchange rate moves only prices. +- Debt interest (V2): it holds. The debt interest variables are inputs with no + equation, the gilt interest series (DIPLDC, IILG) aren't in the code, and + debt (PSND, GGGD) is computed but never used. Only if asked: household + interest payments, a different thing, do respond to Bank Rate (l.623). + +The subtitle is the whole list: we checked each of the 53 points +against the published files. 42 are confirmed (the write-up says "accurate": +22 documented by the OBR, 20 not flagged), 8 are confirmed in part ("partly +true" there), and 3 are about the OBR's forecasting process, which the code +can't settle. The slide's words are the gentler ones; the counts are the +write-up's. + +Each of the three under the cards carries one plain line on what it does: G7, +the same identity twice, so unemployment isn't pinned down (in our test, +raising the participation starting value 2% moved unemployment from 5.4% to +7.3%); G6, nominal GDP and the investment deflator are one equation short, so +our build pins nominal GDP; N5, the foreign-currency term of the corporate +FISIM equation (the margin banks earn on loans and deposits) is added where +its neighbours subtract, about £3.3bn a quarter of cumulative drift as +printed, which we can't tell whether the OBR offsets. + +The three under the cards (G7, G6, N5) are problems in +the published files rather than design choices; G6 and G7 leave nominal GDP / +the investment deflator and unemployment / participation not uniquely +determined. The OBR's workfile may resolve them; the release doesn't show how. +H3 (household interest payments respond to Bank Rate, receipts don't) is the +design choice with the clearest behavioural consequence, if asked. + +The slide shows three of the four problems in the published files; the fourth +is V5, pre-Brexit EU payment equations that are still live. + +Say this; it is no longer a line on the slide. We agree on the main point: as published, the model can't carry fiscal +feedback to output, because GDP is an input. Two refinements, if asked: G2 +(Bank Rate and real wages do reach consumption, just not output) and R2 (the +current account feeds back through investment income). + +Where this could go next (talking points, not on a slide; raise them only if +the discussion goes there): + +- Documented isn't the same as fine: about half the accurate points (22 of 42) + are open in the OBR's own variable list, and a documented gap is still a + gap. +- A point we could lead with together: the published files alone don't + reproduce the OBR's forecast, because the add-factors and calibration aren't + published. What we showed is that our build can't; we can't speak for the + OBR's own workfile. +- Any proposed fix can be tested in the open Python build first. +- What our build adds, if asked: GDP is solved, not imposed; we built the + add-factors; 355 ONS series fill unpublished inputs. + +Sources: published-model review; OBR model README. + +## 7. How it runs (2 steps) + +After the review of the OBR's file, this is our build: how the same equations +are run. Step 1 is the pipeline, step 2 the three example equations. The last +two steps of the pipeline (anchor, score) lead into the next slide. + +The six steps: transpile the EViews listing to Python; fill the inputs the EFO +omits with 355 ONS series; close the model; solve quarter by quarter; anchor +the baseline to the EFO with add-factors; score a reform as the scenario run +minus the baseline. + +The key step is the third (close): in the OBR's file GDP is an input and inventories balance +the expenditure identity. We delete that equation, hold inventories on the EFO +path and make GDP endogenous, so a demand shock can move GDP. The default +closure also switches on the OBR's commented-out l.690 (the nominal-GDP pin); +without it no quarter converges. + +Gauss-Seidel, the solver (named on the "Solve" step; the explanation is no +longer on the slide): it solves the roughly 370 equations together, each +quarter, by computing each variable from the latest values of the others and +repeating until nothing changes. It is EViews' standard model solver (general +knowledge about EViews, not a repo claim), and it needs no derivatives. Don't +say the OBR's file "solves as intended": under the published closure no +quarter converges. Under the default closure +every quarter converges to tolerance (`df.attrs["solver_exit_status"]`). Under +the OBR's published closure it stalls, because the nominal GDP and investment +deflator pair is undetermined (#42, #50), which is why we pin nominal GDP. + +The three equations are from the OBR's listing, written as maths to give a +feel for the model, not as a specification: the consumption error-correction +equation (l.4), the unemployment identity (l.163) and the household income +identity (l.654). Coefficients are rounded to three decimal places on the +slide (0.2645906, 0.1029795, 0.1250582 and 0.4392933 in the listing), and … +marks terms left out. The Python the transpiler emits is not on the slide. + +Sources: the OBR's model code; `transpiler.py`; OBR model README (l.15, l.36, l.152); demo shocks. + +## 8. How well it fits: two very different numbers (2 steps) + +Two mirrored columns: a heading, two stats and three lines each. Step 1 is the +anchored column, step 2 the free-running one. "Average error" is the mean +absolute percentage error (MAPE) over 2025Q1–2027Q4. The subtitle says what +both columns are measured against: the OBR's October 2026 EFO path over those +quarters, not outturn data. It also carries the warning: the free-running gap is this +emulator's, not an OBR forecast error. + +Left, anchored: + +- 0.24% GDP and 0.40% consumption MAPE over 2025Q1–2027Q4, by construction: + add-factors are EFO minus model. Only consumption is re-derived; the other + GDP terms sit on the EFO. +- Reforms are scored as deltas from the anchored baseline, so the add-factors + cancel. +- Every baseline and scenario solve in the demo set converges in 12 of 12 + quarters ("converged" covers the equations that evaluate). +- Unemployment is on the EFO path, also by construction: 5.07% at 2027Q4 + and 4.17% at 2031Q1, the EFO's own figures. Employment and participation + are EFO inputs, and since 18 November (OBR model #74) the forecast 16+ + population follows the path they imply (l.175), so the labour-force + identity (l.163) returns the EFO's rate. It is not an unemployment + forecast: nothing in the model moves unemployment in response to a + scenario. Before #74 the population was held flat and the anchored rate + drained to 3.75% by 2027Q4 and 1.05% by 2031Q1. The anchored GDP gap grows + with the horizon, to 0.77% by 2031Q1. + +Right, free-running (add-factors off, GDP made endogenous, unpublished inputs seeded): + +Say this one carefully. The ~4% free-running error is not the OBR's forecast +error: in the OBR's model GDP is an input, so it can't miss it. The gap +measures our closure swap plus the inputs the OBR doesn't publish. The +platform's registry labels the emulator (the label is no longer on the slide) "anchored to the October 2026 EFO, not +validated as a forecaster; predictive and policy checks weak". + +If asked about the held-add-factor forecast (0.63% GDP, 7 of 8 in band, two +of the seven being identities on EFO inputs): its +GDP line is close to circular, because household income is handed to the +model, so it isn't evidence of forecast skill. + +The free-running figure has the add-factors off, GDP made endogenous and unpublished inputs seeded. + +The right column's figures are from the full scorecard (the table is no longer +on the slide): consumption 7.23%, 9 of 11 within band, and the two poor +ones. Putting the forecast population on the EFO path (#74) moved the +free-running figures: GDP 4.05% to 4.24%, consumption 6.92% to 7.23%, +unemployment 1.17pp (poor) to 0.62pp (fair). GDP and consumption read worse +because the drained unemployment had been lifting raw consumption through +the unemployment term of the consumption equation (l.4): an artefact of the +frozen population, not fit. + +Default closure, October 2026 EFO, 2025Q1–2027Q4. Bands: rates within 1.0pp, +net balances within 1.5% of GDP, levels within 10% MAPE. Employment scores +0.00% because it is an identity of two passthrough inputs. RPI inflation decays +because the RPI index history the OBR doesn't publish runs out. Company profits +are a residual of nominal GDP. The other 10 headline variables (exports, +imports, CPI, earnings and others) are held at the OBR's value. + +The full scorecard: real GDP 4.24%, consumption 7.23%, business investment 7.34%, unemployment rate 0.62pp, household income 3.10%, real household income 3.30%, current account 0.91% of GDP (all fair); trade balance 0.41% of GDP (good); employment 0.00% (trivial identity); RPI inflation 2.32pp, company profits 12.88% (poor). 9 of the 11 computed variables are within band (CI run 44392267520, 18 Nov 2026). + +Sources: calibration scorecard; OBR model README; site_figures.json; population changelog (#74); macro platform README. + +## 9. Part 3: policy scenarios and limits + +Section slide: say what the part covers in one sentence and move on. The tracker at the top of every slide shows the same five parts. + +## 10. Policy scenarios against the OBR's multipliers (2 steps) + +Step 1 is the default setup (three rows); step 2 adds the two rows that need +an opt-in switch. The variable names are no longer on the slide. + +What is simulated, from the shocks table in `docs/demo.md` (rows 1, 2, 4, 4b +and 7). Every shock is sustained every quarter from 2025Q1 for 12 quarters and +scored as the scenario run minus the baseline anchored to the October 2026 EFO: + +- Government consumption: +£1.25bn a quarter of real spending (`CGG` +1,250). +- Income tax: basic rate +1p, £1.725bn a quarter (`TYEM` +1,725, HMRC ready + reckoner). +- VAT +1pp: £2.2bn a quarter (`VREC` +2,200), default closure. +- VAT +1pp with the opt-in price pass-through: the same £2.2bn. +- Government investment: +£3bn a quarter (`CGIPS` +3,000), opt-in investment + closure. + +Each row has the same marks on one line: a dot for the change in GDP per £1 +after 1, 4 and 12 quarters, joined by a line, and an orange tick for the OBR's +published impact multiplier. Every row has the same three dots in the same colours. Where the +values are too close for numbered dots (government consumption, VAT by default +and government investment), the dots are smaller, at their true places, with +the quarter above each. The three values are in the right +column, with the OBR's under them. + +Ratios at quarters 1, 4 and 12, from `docs/demo.md`. Tax rows are current-price +GDP per pound of revenue (the OBR's basis); government consumption is real GDP +per real pound; government investment is real GDP per nominal pound. OBR +benchmarks are the June 2010 estimates restated in EFO July 2015 Box 3.2, all +tapering; the legend dates the orange mark "EFO, July 2015". If asked: the +OBR's November 2023 dynamic-scoring article gives 0.45 for public services +(investment 1.00, welfare 0.60, tax 0.33). Our repo still encodes the 2015 +figure of 0.6 for current spending; the review write-up records that as an +open discrepancy (G11). Against 0.45 the gap to our 1.01 is wider, not +narrower. + +- Government consumption is about 1 by construction: the shock lands in the + expenditure identity. GDP +£1,266m / +£1,280m / +£1,300m at quarters 1 / 4 / + 12. Since 18 November (OBR model #75) the shock carries its cash cost into + nominal spending, so borrowing rises by +£1,336m / +£1,364m / +£1,419m; + receipts have no equation and don't respond. `published_conventions=True` can impose the OBR's 0.6 + fading path as a labelled add-factor (0.60 / 0.51 / 0.27). +- Income tax and employee NICs: the same channel and the same ratios. +- VAT barely moves GDP by default: CPI is exogenous in the listing. The opt-in + pass-through overlay lands near the OBR at quarter 4 (0.345 against 0.35) but + keeps building (0.638 by quarter 12); the match isn't a calibration. +- Government investment works only under the opt-in investment closure, as + identity pass-through with no taper. + +Sources: demo shocks (`docs/demo.md`); demo_shocks.json; price pass-through changelog (#70); spending-shock changelog (#75). + +## 11. Income tax +1p: what the OBR model does to GDP (2 steps) + +Everything on this slide is the OBR model alone, with HMRC's costing as the +input: the chart is not a PolicyEngine result and shows no distribution. It is +the one channel with real behaviour: consumption is the only behavioural +response here. The PolicyEngine line sits apart, under "With +PolicyEngine". + +The chart is a time series, not a distribution: UK GDP below baseline for the +12 quarters 2025Q1 to 2027Q4 (quarter 1 is 2025Q1). Nothing on this slide is by +decile; who pays is the micro-to-macro slide (19). Step 1 is the chart, with the four-step route above it (HMRC costing → +household income → consumption → GDP); step 2 is the panel of three takeaways. +Only quarters 1, 4, 8 and 12 carry a value; the others are 227, 285, 381, 420, +454, 507, 528 and 548 (£m, falls). + ++1p on the basic rate, £1,725m a quarter (HMRC ready reckoner, June 2025, +2026-27 column, £6.9bn a year divided by four), sustained from 2025Q1. Real +GDP falls 161 at quarter 1, 335 at quarter 4, 482 at quarter 8 and 565 at +quarter 12 (£m; quarters 1 to 4 are unchanged by OBR model #74, later ones +moved under 1%). Ratio 0.10 / 0.21 / 0.37 against the OBR's 0.3, which fades; +the panel says the same in pence per £1 of tax (10p, 37p, 30p), which is current-price GDP per +pound of current-price revenue. Receipts and borrowing +move one for one; lower consumption doesn't reduce other receipts. GDP change +equals the consumption change to the pound. + +Where the change comes from, which is the route above the chart: + +- The OBR model has no tax calculator. The revenue is an input: `TYEM` (income + tax) is exogenous in the listing, and we shock it by £1,725m a quarter, the + HMRC ready reckoner figure. +- `TYEM` feeds household taxes (l.612) and so household income (`HHDI`, l.654); + the OBR's own consumption equation (l.4) then lowers spending. GDP moves + because our build solves it; in the OBR's file it is fixed. +- "Real behaviour" means only that consumption equation. Imports don't + respond: the GDP change equals the consumption change to the pound. +- The line under "With PolicyEngine" carries no number. PolicyEngine's static + costing of the same 1p is £1,616m a quarter in the model README's + household-tax row, and £6.55bn a year (about £1,637m a quarter) in the + platform's bridge benchmark on slide 19: two vintages of the same costing. + The deck shows only the second. Either gives the same ratios (0.37 at + quarter 12): the GDP path scales with the input, only the ratio is the + same. +- "Similar size, opposite path": the README's own words are "right order of + magnitude" with the profile reversed. The OBR's 0.3 is an impact multiplier + that fades; ours starts at 0.10 and builds. + +The OBR model does not return decile impacts: it is an aggregate model with +one consumption equation and no household split. Deciles come from +PolicyEngine's microsimulation, run alongside (slide 19). The PolicyEngine +costing on this slide only changes the size of the input. + +Sources: demo shocks; demo_shocks.json; OBR model README (l.33). + +## 12. Investment: off by default, on with one switch (3 steps) + +Step 1 is the switch card (off: the OBR's file; on: our opt-in); step 2 +corporation tax; step 3 government investment. + +In the OBR's file total investment is an input (`IF` has no live equation), +so corporation tax and public investment do nothing to GDP by default, and +`run_reform` warns. `investment_closure=True` switches on the listing's own +commented-out `IF` identity (l.86). For corporation tax the line that matters +is the commented-out business-investment equation (l.92), which we rebuilt +with its missing bracket closed (after `KGAP(-2)`, where the OBR's Briefing +paper No. 5, equation 2.38, closes it; review write-up N1). + +The chip on the switch card ("stop-gap"): the investment closure freezes MSGVA, PIF and PIRHH to keep the run stable; without the guard, a +zero-shock baseline runs business investment from £86bn to £522bn by 2027Q4. + +- Corporation tax +5pp: nothing in quarters 1–2, then −£78m at quarter 4 and + −£384m at quarter 12 (0.05% of GDP), 40% of a plateau of about £0.96bn a + quarter. The OBR multiplier table the repo encodes has no corporation-tax + row. +- Government investment +£3bn a quarter: +£3,075m / +£2,901m / +£2,903m at + quarters 1 / 4 / 12. Under the default closure IF has no live equation, so + the channel is dead and `run_reform` warns. + +On the slide "still falling, towards about −£0.96bn a quarter" is the plateau, +and "about £1 of GDP per £1, with no fade" is identity pass-through at about +1.0 with no taper, against the OBR's 1.0, tapering. + +Sources: demo shocks (rows 5 and 7); OBR model README (l.31, l.34). + +## 13. Bank Rate (2 steps) + +Step 1 is the three bars; step 2 the channels beside them (two respond, five +don't). + ++1pp for four quarters, peak at quarter 4: −0.057% of GDP in the default run +(mortgage rate held, a lower bound), −0.149% with `monetary_conditioning=True` +(mortgage rate moved at the 0.9 pass-through in the OBR's l.623). The Bank of +England's range for the same experiment is −0.2% to −0.35% after about a year +(Quarterly Bulletin 1999 Q2). About −0.16% is the ceiling even with mortgage +and deposit rates both moved. CPI and unemployment don't respond, by design. + +Only consumption and household interest respond. Investment, sterling, house prices and gilts have no interest-rate equation in the listing. + +Retail rates, gilts, sterling and house prices have no equation: they are the +OBR's conditioning assumptions, set by judgement or from market curves. The +business-investment equation is commented out in the OBR's file. The Bank of +England range is shown as one bar from −0.2% to −0.35%. + +Sources: demo shocks (rows 6 and 6b); monetary conditioning; OBR model README (l.35). + +## 14. Known limits, and whose they are (2 steps) + +The slide separates limits we inherit from the OBR's published model (step 1) +from limits of our replication (step 2). + +Inherited: + +- Bank Rate: −0.057% of GDP unconditioned and −0.149% with the mortgage rate + moved, against the Bank of England's −0.2% to −0.35%. Only consumption and + household interest respond. +- Spending: in the OBR's file GDP is an input, so a spending change moves GDP + by nothing; the multiplier of about 1 (1.01 on impact, 1.04 by quarter 12) + appears once our closure solves GDP. What we inherit is that nothing in the + equations damps it: imports and prices don't respond, and there is no + crowding out. So the equations can't produce the OBR's 0.6 (the 2015 + figure; see slide 10 on 0.45). Borrowing now moves by the cash cost: since + 18 November (OBR model #75) the default spending shock also raises nominal + spending, so borrowing rises by £1,336m to £1,419m a quarter for £1.25bn of + real spending. That is accounting: receipts have no equation and don't + respond. `nominal_consistent=False` gives the earlier real-only shock, with + borrowing unchanged. +- CPI has no live equation, so VAT barely transmits. The pass-through overlay + is labelled judgement, not the shipped listing. + +Ours: + +- 82 of the 372 equations drop in at least one quarter because an input has no + data. +- Unpublished inputs are seeded or estimated, and labelled. +- Every result is a point estimate; our engine has no stochastic simulation. + +Not a limit, so not on the slide: the household-tax fix (#71). Their ONS +components aren't seasonally adjusted while the aggregate is, which put a +−10.6% / −12.5% first-quarter dip into household income. Holding them on their +data path took the free-running GDP error from 4.25% to 4.05% and household +income from 4.30% to 3.08%. That is an artefact removed, not better fit. +Seasonally adjusting the components is the follow-up. + +No longer a limit, so off the slide: unemployment drift. Before 18 November +the forecast 16+ population was held flat, and the anchored unemployment rate +drained to 1.05% against the EFO's 4.17% by 2031Q1 (l.163 and l.175 are one +identity, so nothing held participation on the EFO path). OBR model #74 puts +the population on the path the EFO implies, so anchored unemployment is now +the EFO's (slide 8). That is by construction, not a forecast: unemployment +still doesn't respond to any scenario. + +Sources: OBR model README; site_figures.json; demo shocks; TYWHH changelog +(#71); population changelog (#74); spending-shock changelog (#75). + +## 15. Part 4: the macro platform + +Every slide in this part carries an amber "Preview, not yet launched" marker +under its title. + +Section slide: say what the part covers in one sentence and move on. The tracker at the top of every slide shows the same five parts. + +## 16. The macro platform + +Not yet launched. The status column quotes the site's own label for each +model, word for word (its "Where each model fails" section): exact for +implemented rules (the microsimulation), anchored, not validated (the OBR +emulator), partial replication (BoE SVAR, DEFINE-UK, US HANK), calibrated, no +outcome benchmark (OG-UK), replicates the Fed's solver (FRB/US). The site +says none is validated as a forecaster. + +Seven public models (`site_contract.py`'s list), each with +its own repo. Results from different model classes are complementary, not +comparable, and the scoring tool won't average them. FRB/US and HANK refuse +reform scoring on purpose: no mapping from a PolicyEngine reform exists, and +inventing one would give plausible-looking wrong numbers. + +OG-UK's "Yes" under "Scores reforms" carries the site's own qualifier, "none +published". DEFINE-UK is on the table as one of the seven; its results are scenario deltas from a partial replication, run locally. Don't quote a multiplier for it: which one to headline is open. + +Sources: model comparison page; macro platform README. + +## 17. The platform, live + +- Click the frame, then use the buttons: Home, Models, Compare, OBR model, + OBR validation, Forecasts. Expand fills the screen; New tab opens the site. +- Say it's in development and not launched. Its OBR numbers are older than + the deck's: on 19 November the live OBR and OBR validation pages still + quoted the anchored GDP error as 0.44% and the free-running one as 4.25%, + and described unemployment as drifting. The deck follows the model repo + after #74 and #75 (0.24%, 4.24%, unemployment on the EFO path); the site + catches up when it is re-pinned (PolicyEngine/macro #278). If someone + reads a number off the frame, say so. +- If the frame is blank (offline, or the site's frame headers not yet live), + use New tab. + +Live demo, if time (this replaces the old demo slide): + +Before the session: `uv sync` and run one `run_reform` call, because the first +build takes a few minutes. If using `score_reform`, start it through +`start_job` before the meeting: a five-year score takes over ten minutes. + +1. `run_reform(name="demo", var="CGG", shock=1250, periods=12)`, then income + tax (`var="TYEM", shock=1725`). +2. VAT with `price_passthrough=True`; Bank Rate (`var="R", shock=1.0, + periods=4`) with `monetary_conditioning=True`. Run overlays locally: hosted + `obr_shock` has no overlay parameter, and the hosted model (2965e82, the pin + in the macro repo at 2e5dffe7, which the deck uses; the OBR repo's demo.md + names e4d7faa instead) is 21 + commits behind main, before #70, #71, #74 and #75. #70 left defaults + unchanged to the pound and #71 left reform deltas unchanged, by their own + changelogs; #74 leaves quarters 1 to 4 unchanged and moves later ones by + under 1%; #75 means a hosted spending run still shows borrowing unchanged. +3. The dashboard at obr-macroeconomic-model.vercel.app. +4. In Claude with the MCP connector: "Score raising the UK basic rate of income + tax to 21p." + +Don't run live: government investment under the default closure (GDP doesn't +move), corporation tax as receipts (`NNSCTP`, GDP exactly zero), or the +published closure in a demand run (no quarter converges). + +Sources: the live site; demo shocks; Use page; `integration/pyproject.toml` (hosted pin). + +## 18. Use it from Claude (3 steps) + +The slide shows the three steps someone takes in Claude; the details are from +the site's Use page and `mcp_server.py`. + +1. Connect. In Claude: Settings → Connectors → Add custom connector, and paste + `https://policyengine--policyengine-macro-mcp-serve.modal.run/mcp` (some + plans gate custom connectors). In Claude Code: `claude mcp add --transport + http policyengine-macro + https://policyengine--policyengine-macro-mcp-serve.modal.run/mcp`. ChatGPT + and other MCP clients work the same way. +2. Ask in plain language. The example is one of the Use page's prompts: "Score + raising the UK basic rate of income tax to 21p." +3. Claude calls the tools: `score_reform`, run through `start_job` on the + hosted server because a five-year score outlasts one request; + `get_job_result` to poll it; `format_score_report` to render it. With + `model="obr"` the answer has the static costing and the change in GDP, + consumption and investment, with assumptions and caveats attached. The + slide shows no result numbers on purpose. + +- Hosted MCP server: 28 tools at the pinned commit (the README still says 26). + No install, account or key; scales to zero, so the first call may take about + 10 seconds. +- CLI: 27 commands. The `[models]` extra pins each git dependency to a full + SHA; OG-UK and DEFINE-UK's R runtime are local-only. +- Dated data snapshots under `data/vintages/`, never edited, so any score can + be reproduced against the data it saw. + +One click per step. The first card also lists the other ways in: the MCP server, the CLI, Python (`run_reform()`) and the dashboard. The dated data snapshots are no longer on the slide. + +Sources: Use page; `mcp_server.py`; `cli.py`; macro platform README. + +## 19. An example in use: AI and the UK economy + +- Live embed of PolicyEngine's unpublished AI study, "AI and the UK economy: + Beyond the forecast" (Vercel preview of `uk-growth-with-ai`, deployed 19 Nov + 2026). Say clearly: not published, results provisional. +- Why it's here: one question answered with two of the platform's models, + side by side and never added together. OG-UK covers the whole economy over + decades; PolicyEngine UK covers households in one year, FY 2027-28. +- Use the Story tab for the four parts. Explore has results by topic, and + Method and sources lists every input. +- Don't quote its figures as findings; they're scenarios, not forecasts. +- If the frame is blank, press New tab. + +## 20. From a microsimulation reform to GDP (3 steps) + +Step 1 is the reform, entered once; step 2 the household answer; step 3 the +route to the economy answer. The check against HMRC sits in the static-cost +card, and the GDP card points back to the income-tax slide. + +One worked example, the basic rate +1p, giving two answers. Households: the +decile changes, winners and losers and poverty come straight from the +PolicyEngine-UK microsimulation and stay there; the OBR model has no +households. Economy: the microsimulation's static cost (£6.55bn a year) goes +through the bridge into the OBR model, and GDP, consumption and investment +come out. The GDP path on slide 11 is the same reform with HMRC's costing +(£1,725m a quarter) as the input; don't mix the two bases. + +`score_reform(model="obr")`: a PolicyEngine-UK reform is costed per year with +the population microsimulation, enters the OBR model as a quarterly +`HHDI_ADDFACTOR` path, and GDP, consumption and investment come out. It is a +demand-side approximation, not a general incidence model; corporation-tax +reforms are refused. Distribution comes from the microsimulation itself. When +we report poverty we headline before housing costs, with after housing costs +alongside; the platform's population tool doesn't return poverty rates yet. +The static costing of 1p on the basic rate (£6.55bn, 2026-27) is 5.1% below +HMRC's ready reckoner (£6.9bn): static and survey-based against +post-behavioural and administrative. + +Sources: `mcp_server.py`; `capabilities.py`. + +## 21. Part 5: working together + +Section slide: say what the part covers in one sentence and move on. The tracker at the top of every slide shows the same five parts. + +## 22. Where we could work together + +Options to discuss, not commitments. Each maps to something open in the repo: +the closure choice and receipts that respond to the economy (receipts have no +equation, so a scenario moves only the revenue it is given); the investment +closure and DEFINE-UK; macro paths back into household results; the published +listing's open problems (G6, G7, N5); an unemployment rate that responds to +demand (on the anchored path it is the EFO's by construction, and no scenario +moves it); joint write-ups. Two earlier items are done: the spending shock now +moves borrowing (#75) and the forecast population follows the EFO (#74). + +Sources: OBR model README; published-model review; DEFINE-UK model page. + +## 23. Questions for NEF + +Listen more than talk here. + +Next steps to propose (this replaces the old next-steps slide); agree owners +and dates in the room: + +1. A hands-on session: run a scenario NEF chooses, together. +2. Pick two or three questions: agree scope, closures and what counts as a + check. +3. A shared review of the open equation and closure issues on GitHub. +4. A check-in date to review results and a possible write-up. + +## 24. Thank you + +Contact on the slide: vahid@policyengine.org. diff --git a/slideshows/nef-2026/config.ts b/slideshows/nef-2026/config.ts new file mode 100644 index 00000000..cc013ff7 --- /dev/null +++ b/slideshows/nef-2026/config.ts @@ -0,0 +1,71 @@ +import type { SlideshowConfig } from "@/lib/types"; +import { + AccessSlide, + AiExampleSlide, + AgendaSlide, + ArchitectureSlide, + BankRateSlide, + ClosingSlide, + CollaborateSlide, + FitSlide, + IncomeTaxSlide, + InvestmentSlide, + LimitsSlide, + LiveSiteSlide, + MicroMacroSlide, + ModelSectionSlide, + ModulesSlide, + MultipliersSlide, + PlatformSectionSlide, + PlatformSlide, + PublishedVsBuiltSlide, + QuestionsSlide, + ScenariosSectionSlide, + ThibReviewSlide, + TitleSlide, + TogetherSectionSlide, +} from "./slides"; + +export const nef2026Config: SlideshowConfig = { + id: "nef-2026", + title: "Opening up the OBR macroeconomic model", + description: + "PolicyEngine's open-source Python implementation of the OBR's published macroeconomic model: how it runs, how well it fits, and where to work together.", + // The exact meeting date isn't fixed; a day of 01 renders as "November 2026". + date: "2026-11-01", + location: "New Economics Foundation", + footerText: "New Economics Foundation · November 2026", + clickerKeys: true, + // The counter shows the slide, not the build step within it. + countSlides: true, + // The hint sits on the footer logo in this deck. + hideNavHint: true, + // Builds reveal a slide step by step when presenting; a PDF export shows + // each slide once, complete (exportBuilds: 1, and BuildScope shows every step). + slides: [ + TitleSlide, + AgendaSlide, + ModelSectionSlide, + { component: PublishedVsBuiltSlide, builds: 3, exportBuilds: 1 }, + { component: ModulesSlide, builds: 5, exportBuilds: 1 }, + { component: ThibReviewSlide, builds: 4, exportBuilds: 1 }, + { component: ArchitectureSlide, builds: 2, exportBuilds: 1 }, + { component: FitSlide, builds: 2, exportBuilds: 1 }, + ScenariosSectionSlide, + { component: MultipliersSlide, builds: 2, exportBuilds: 1 }, + { component: IncomeTaxSlide, builds: 2, exportBuilds: 1 }, + { component: InvestmentSlide, builds: 3, exportBuilds: 1 }, + { component: BankRateSlide, builds: 2, exportBuilds: 1 }, + { component: LimitsSlide, builds: 2, exportBuilds: 1 }, + PlatformSectionSlide, + PlatformSlide, + LiveSiteSlide, + { component: AccessSlide, builds: 3, exportBuilds: 1 }, + AiExampleSlide, + { component: MicroMacroSlide, builds: 3, exportBuilds: 1 }, + TogetherSectionSlide, + CollaborateSlide, + QuestionsSlide, + ClosingSlide, + ], +}; diff --git a/slideshows/nef-2026/content.ts b/slideshows/nef-2026/content.ts new file mode 100644 index 00000000..94653b04 --- /dev/null +++ b/slideshows/nef-2026/content.ts @@ -0,0 +1,729 @@ +import moduleLinkMatrix from "./module-links.json"; + +// Every figure on the slides comes from a file read at a pinned commit, checked +// on 18 November 2026 and, for the OBR model, again on 19 November: +// - PolicyEngine/obr-macroeconomic-model main 0e44ec87 (after #70–#72, #74 and +// #75: the forecast 16+ population on the EFO-implied path, and the +// nominal-consistent government-consumption shock); +// - PolicyEngine/macro main 2e5dffe7 (after #275); +// - PolicyEngine/obr-presentation main f4f819a7 (the July 2025 NEF deck). +// OBR-model numbers are taken from the model repo, not from the macro site, +// which still quoted the pre-#71 scorecard (4.25%) at its pinned commit. +const obrCommit = "0e44ec87681eba0a1f61d634875f5431ac2344c8"; +const macroCommit = "2e5dffe7a2b35d189c8df60ff2012abbdb675367"; +const priorDeckCommit = "f4f819a786dc6d33f5836aae22d4d5f93aa778da"; + +const obr = `https://github.com/PolicyEngine/obr-macroeconomic-model/blob/${obrCommit}`; +const macro = `https://github.com/PolicyEngine/macro/blob/${macroCommit}`; + +export type Source = { label: string; href: string }; + +export const sources = { + aiReport: { + label: "AI and the UK economy: Beyond the forecast (preview, not published)", + href: "https://uk-growth-with-mjl646jhp-policy-engine.vercel.app", + }, + liveSite: { + label: "PolicyEngine macro site (live, in development)", + href: "https://policyengine-macro.vercel.app", + }, + obrReadme: { label: "OBR model README", href: `${obr}/README.md` }, + listing: { + label: "OBR model code, October 2025", + href: `${obr}/obr_macro/_data/obr_model_code_october_2025.txt`, + }, + transpiler: { label: "transpiler.py", href: `${obr}/obr_macro/transpiler.py` }, + scorecard: { + label: "Calibration scorecard", + href: `${obr}/docs/calibration_scorecard.md`, + }, + demo: { label: "Demo shocks", href: `${obr}/docs/demo.md` }, + demoResults: { + label: "demo_shocks.json", + href: `${obr}/results/demo_shocks.json`, + }, + siteFigures: { + label: "site_figures.json", + href: `${obr}/results/site_figures.json`, + }, + review: { + label: "Published-model review", + href: `${obr}/docs/published_model_review.md`, + }, + roadmap: { label: "OBR model roadmap", href: `${obr}/docs/ROADMAP.md` }, + forecasting: { + label: "Forecasting framework", + href: `${obr}/docs/forecasting_framework.md`, + }, + monetary: { + label: "Monetary conditioning", + href: `${obr}/docs/monetary_conditioning.md`, + }, + tywhh: { + label: "TYWHH changelog (#71)", + href: `${obr}/changelog.d/tywhh-seasonal-basis.fixed.md`, + }, + pop16: { + label: "Population changelog (#74)", + href: `${obr}/changelog.d/pop16-efo-path.fixed.md`, + }, + nominalSpending: { + label: "Spending-shock changelog (#75)", + href: `${obr}/changelog.d/nominal-consistent-spending.changed.md`, + }, + passthrough: { + label: "Price pass-through changelog (#70)", + href: `${obr}/changelog.d/price-passthrough-60.added.md`, + }, + macroReadme: { label: "Macro platform README", href: `${macro}/README.md` }, + compare: { label: "Model comparison page", href: `${macro}/models/index.html` }, + definePage: { label: "DEFINE-UK model page", href: `${macro}/define/index.html` }, + forecastPage: { + label: "Forecast track record", + href: `${macro}/forecasts/index.html`, + }, + forecastScores: { + label: "scorecard.json", + href: `${macro}/forecasts/scorecard.json`, + }, + forecastRules: { + label: "Forecast archive rules", + href: `${macro}/forecasts/README.md`, + }, + mcpServer: { + label: "mcp_server.py", + href: `${macro}/integration/src/policyengine_macro/mcp_server.py`, + }, + cli: { label: "cli.py", href: `${macro}/integration/src/policyengine_macro/cli.py` }, + capabilities: { + label: "capabilities.py", + href: `${macro}/integration/src/policyengine_macro/capabilities.py`, + }, + hostedPin: { + label: "integration/pyproject.toml", + href: `${macro}/integration/pyproject.toml`, + }, + connect: { label: "Use page (MCP, CLI, Python)", href: `${macro}/connect/index.html` }, + priorDeck: { + label: "July 2025 NEF deck", + href: `https://github.com/PolicyEngine/obr-presentation/blob/${priorDeckCommit}/NEF%20x%20PolicyEngine.pptx`, + }, + obrRepo: { + label: "PolicyEngine/obr-macroeconomic-model", + href: "https://github.com/PolicyEngine/obr-macroeconomic-model", + }, + macroRepo: { + label: "PolicyEngine/macro", + href: "https://github.com/PolicyEngine/macro", + }, +} satisfies Record; + +// --------------------------------------------------------------------------- +// What the OBR publishes and what we built (README "Features" and "Pins"; +// ROADMAP "What 'what the OBR has' decomposes into"; forecasting_framework.md +// "The data that made it work"). +export const listing = { + equations: 372, + // Dropped in at least one quarter of the pinned 2025Q1–2027Q4 reform solve + // because an input has no data (README; demo.md "Closure"). + droppedEquations: 82, + onsSeries: 355, + // Endogenous variables the model referenced but the EFO did not publish, and + // how many of them had ONS codes (forecasting_framework.md). + missingEndogenous: 261, + missingWithOnsCodes: 199, + listingDate: "15 October 2025", + efo: "October 2026 EFO", + efoShort: "Oct 2026", + efoPublished: "28 October 2026", +}; + +// One entry per layer; the slide shows each as a card. `obr` is what the OBR +// has, `ours` what the Python build has. The stand-ins sit in the judgement +// card (model README at the pinned commit): anchoring, l.27-28 (add-factors +// are EFO minus model; reforms are scored around the anchored baseline, so +// they cancel); the three opt-in overlays in run_reform, l.141 (labelled +// judgement, not model dynamics), with l.30 (published_conventions: the +// OBR's multipliers and taper), l.35 (monetary_conditioning: mortgage rate at +// the listing's 0.9 pass-through) and l.32 (price_passthrough: VAT into CPI); +// and a user's own assumptions, by changing any input path through +// run_reform. +export const layers = [ + { + title: "The model", + obr: "372 equations, published as EViews code", + ours: "All 372 transpiled to Python", + status: "built", + }, + { + title: "The engine", + obr: "EViews solver, closures, add-factors", + ours: "Gauss-Seidel solver, closures, add-factors", + status: "partial", + }, + { + title: "The judgement", + obr: "Add-factors and assumptions, unpublished", + ours: "Stand-ins, each labelled", + status: "standin", + }, +] as const; + +// Terms glossed where they first appear, in the engine card (standard +// definitions, not claims from the repo). +export const engineTerms = [ + { title: "Closure", text: "which variables are solved, which are inputs" }, + { title: "Add-factor", text: "an adjustment added to an equation's result" }, +]; + +// The EFO, spelled out where it first appears (the judgement card). +export const efoGloss = { + name: "Economic and Fiscal Outlook (EFO)", + what: "The OBR's twice-yearly forecast: our baseline", +}; + +export const judgementStandIns = [ + { title: "Anchoring", text: "the OBR's forecast minus model" }, + { title: "Opt-in overlays", text: "multipliers, mortgage rate, VAT" }, + { title: "Your own", text: "change any input path" }, +]; + +// The solver (model README l.15 and l.152: Gauss-Seidel iteration over ~370 +// equations; l.36: every quarter converges to tolerance under the default +// closure; under the published closure no quarter converges, README "Solver +// convergence"). +export const solver = { + what: "Each variable from the others' latest values, repeated until nothing changes", +}; + +export const pipeline = [ + { title: "Transpile", text: "EViews to Python" }, + { title: "Fill inputs", text: "355 ONS series" }, + { title: "Close", text: "GDP solved, not an input" }, + { title: "Solve", text: "Gauss-Seidel, by quarter" }, + { title: "Anchor", text: "Add-factors to the EFO" }, + { title: "Score", text: "Scenario minus baseline" }, +]; + +// --------------------------------------------------------------------------- +// The model's modules, from the section headers of the OBR's listing +// (obr_macro/_data/obr_model_code_october_2025.txt at the pinned commit). +// Counts are the equations our parser (transpiler.parse_equation) reads under +// each header; they sum to 372. The listing has no Group 13 or Group 17. +// Mapping: GDP and output = Group 16 (29) + market sector GVA satellite (4); +// consumption = Group 1; investment and inventories = Groups 2 (7) + 3 (42); +// labour market = Group 4; exports = Group 5; imports = Group 6; prices and +// wages = Group 7; North Sea oil = Group 8; public sector = Groups 9 (15) + +// 10 (13) + 12 (31); balance of payments = Group 11; income accounts = +// Group 15; finance and balance sheets = Group 14 (5) + Group 18 +// (households 28, rest of world 23, non-financial companies 13). +// "exogenous" notes are from docs/published_model_review.md (G1, N1, R1, G3, +// V1). Variables are left-hand sides in that section of the listing. +export type ModelModule = { + name: string; + equations: number; + variables: string; + exogenous?: string; +}; + +export const modelModules: ModelModule[] = [ + { name: "GDP and output", equations: 33, variables: "GDPMPS, GVA, MSGVA", exogenous: "Real GDP exogenous" }, + { name: "Consumption", equations: 5, variables: "CONS, CDUR, PD" }, + { name: "Investment and inventories", equations: 49, variables: "IBUS, COC, DINV", exogenous: "Total investment exogenous" }, + { name: "Labour market", equations: 17, variables: "ET, ULFS, LFSUR" }, + { name: "Exports", equations: 3, variables: "XNOG, RPRICE, XPS", exogenous: "Volumes exogenous" }, + { name: "Imports", equations: 15, variables: "MNOG, MS, MPS", exogenous: "Volumes exogenous" }, + { name: "Balance of payments", equations: 31, variables: "TB, CB, NIPD" }, + { name: "North Sea oil", equations: 5, variables: "TDOIL, PXOIL, NSGTP" }, + { name: "Prices and wages", equations: 44, variables: "EARN, CPIX, RPI", exogenous: "CPI: no live equation" }, + { name: "Income accounts", equations: 42, variables: "HHDI, RHHDI, FYEMP" }, + { name: "Public sector", equations: 59, variables: "CGG, PSCR, CGNB", exogenous: "Most taxes exogenous" }, + { name: "Finance and balance sheets", equations: 69, variables: "M4, NFWPE, NIIP" }, +]; + +// Three equations from the listing, written as maths (KaTeX source). +// Coefficients are rounded to 3 decimal places for the slide (l.4: 0.2645906, +// 0.1029795, 0.1250582, 0.4392933); \dots marks terms trimmed for the slide. +// Line numbers are lines of the listing file; `eviews` is the listing's own +// text with runs of spaces collapsed and the same terms trimmed. +export const equationExamples = [ + { + label: "Consumption", + kind: "Error correction", + line: 4, + eviews: + "dlog(CONS) = 0.2645906 + 0.1029795 * dlog(RHHDI) … - 0.1250582 * (log(CONS(-1)) - 0.4392933 * log(RHHDI(-1)) …)", + tex: String.raw`\Delta \ln \mathit{CONS}_t = 0.265 + 0.103\,\Delta \ln \mathit{RHHDI}_t - \dots - 0.125\,\bigl(\ln \mathit{CONS}_{t-1} - 0.439 \ln \mathit{RHHDI}_{t-1} - \dots\bigr)`, + }, + { + label: "Unemployment", + kind: "Identity", + line: 163, + eviews: "ULFS = ((POP16 * PART16 / 100) - ETLFS)", + tex: String.raw`\mathit{ULFS}_t = \dfrac{\mathit{POP16}_t \times \mathit{PART16}_t}{100} - \mathit{ETLFS}_t`, + }, + { + label: "Household income", + kind: "Accounting identity", + line: 654, + eviews: "HHDI = MI + FYEMP - EMPSC - EESC - TYWHH + NMTRHH + SBHH + …", + tex: String.raw`\mathit{HHDI}_t = \mathit{MI}_t + \mathit{FYEMP}_t - \mathit{EMPSC}_t - \mathit{EESC}_t - \mathit{TYWHH}_t + \mathit{NMTRHH}_t + \mathit{SBHH}_t + \dots`, + }, +]; + +// Links between the modules: module-links.json is written by module-links.py +// from the listing. Its 12 x 12 matrix counts, for each pair of modules, the +// equations in the target module whose right-hand side uses a variable the +// source module determines (lags count, commented-out lines don't). The +// script also sorts the modules into three groups and counts the same thing +// between groups (an equation counts once per source group). +const groupsOf: Record = moduleLinkMatrix.groups; + +export const moduleGroups = moduleLinkMatrix.groupOrder.map((name) => ({ + name, + modules: groupsOf[name] ?? [], +})); + +export const groupLinkCount = (from: string, to: string) => + moduleLinkMatrix.groupMatrix[moduleLinkMatrix.groupOrder.indexOf(from)]?.[ + moduleLinkMatrix.groupOrder.indexOf(to) + ] ?? 0; + +// The six flows between the groups. Each label names the largest module +// links inside the flow (from the 12 x 12 matrix): GDP and output → prices +// and wages 16; prices and wages → investment 6, consumption 5, imports 3; +// GDP and output → finance and balance sheets 11, income accounts 5; public +// sector → GDP and output 7, imports 5; income accounts → prices and wages +// 10, balance of payments → prices and wages 8 (the exchange rate into costs +// and trade prices); prices and wages → income accounts 3, labour market → +// public sector 2, finance 2. +export type GroupFlow = { from: string; to: string; label: string[] }; + +export const groupFlows: GroupFlow[] = [ + { from: "Demand", to: "Supply and prices", label: ["Output → prices"] }, + { from: "Supply and prices", to: "Demand", label: ["Prices → spending"] }, + { + from: "Demand", + to: "Income and sectors", + label: ["Output → incomes,", "balance sheets"], + }, + { + from: "Income and sectors", + to: "Demand", + label: ["Government →", "output, imports"], + }, + { + from: "Supply and prices", + to: "Income and sectors", + label: ["Prices, jobs →", "incomes"], + }, + { + from: "Income and sectors", + to: "Supply and prices", + label: ["Incomes, exchange", "rate → prices"], + }, +]; + +// Module links drawn dashed inside the demand group: the spending components +// feed total final expenditure (TFE, TFEPS; imports feed GDPMPS), but real +// GDP is an input in the OBR's file (review G1) and trade volumes are +// exogenous (R1), so they don't move GDP there. +export const cutLinks = [ + "Consumption", + "Investment and inventories", + "Exports", + "Imports", +].map((from) => ({ from, to: "GDP and output" })); + +// --------------------------------------------------------------------------- +// Line-by-line review of the published listing (published_model_review.md, +// "Summary"). +export const review = { + points: 53, + accurate: 42, + documented: 22, + notFlagged: 20, + partly: 8, + uncheckable: 3, +}; + +// `means` says in plain words what each error does (published_model_review.md +// entries G7, G6 and N5; N5's "about £3.3bn a quarter" is that entry's own +// figure for the printed form, with foreign-currency lending of about £235bn). +export const reviewFindings = [ + { + code: "G7", + title: "Unemployment undetermined", + refs: "l.163 and l.175", + means: "The same equation is written twice, so nothing pins down unemployment as published", + }, + { + code: "G6", + title: "Nominal GDP has no unique solution", + refs: "l.337 and l.688", + means: + "Two equations are one identity, so nominal GDP and the investment price index aren't pinned down. Our build pins nominal GDP", + }, + { + code: "N5", + title: "Apparent sign error", + refs: "l.637, bank margins (FISIM)", + means: + "One term is added where its neighbours subtract: about £3.3bn a quarter of drift into company profits, as printed", + }, + { + code: "V5", + title: "Pre-Brexit EU payments", + refs: "", + means: "Equations still live", + }, +]; + +// --------------------------------------------------------------------------- +// Anchoring and fit (README "Read this before quoting a number"; +// calibration_scorecard.md; site_figures.json "anchored_horizon": 0.242 and +// 0.397, shown to two decimals as the README does). +export const anchored = { + gdpMape: "0.24", + consMape: "0.40", + window: "2025Q1–2027Q4", + convergedQuarters: 12, +}; + +// calibration_scorecard.md, default closure, 18 Nov 2026 (after #74): 9 of 11 +// computed variables within band. +export const freeRunning = { + gdpMape: "4.24", + computed: 11, + headline: 21, + withinBand: 9, +}; + +// The macro platform's registry status for the emulator, verbatim +// (README model table, from capabilities.py). +export const registryStatus = + "anchored to the October 2026 EFO, not validated as a forecaster; predictive and policy checks weak"; + +export type ScoreRow = { + variable: string; + error: string; + status: "good" | "fair" | "poor" | "trivial"; +}; + +// calibration_scorecard.md table, default closure (nominal-GDP pin), +// October 2026 EFO, 2025Q1–2027Q4 (CI run 44392267520, 18 Nov 2026). +export const scorecardRows: ScoreRow[] = [ + { variable: "Real GDP", error: "4.24%", status: "fair" }, + { variable: "Consumption", error: "7.23%", status: "fair" }, + { variable: "Business investment", error: "7.34%", status: "fair" }, + { variable: "Household income", error: "3.10%", status: "fair" }, + { variable: "Real household income", error: "3.30%", status: "fair" }, + { variable: "Current account", error: "0.91% of GDP", status: "fair" }, + { variable: "Trade balance", error: "0.41% of GDP", status: "good" }, + { variable: "Employment", error: "0.00%", status: "trivial" }, + { variable: "Unemployment rate", error: "0.62pp", status: "fair" }, + { variable: "RPI inflation", error: "2.32pp", status: "poor" }, + { variable: "Company profits", error: "12.88%", status: "poor" }, +]; + +// --------------------------------------------------------------------------- +// Scenarios against the OBR's published multipliers (demo.md table; ratios are +// current-price GDP per pound of current-price revenue for the tax rows, real +// GDP per pound for spending; OBR benchmarks from EFO July 2015 Box 3.2 as +// encoded in the repo). +export type MultiplierRow = { + label: string; + /** The opt-in switch the row runs under, if any. */ + setting?: string; + q1: number; + q4: number; + q12: number; + obr: number; + obrLabel: string; + /** The q1 / q4 / q12 ratios exactly as demo.md prints them. */ + display: string; + /** What was simulated (demo.md "The shocks": size per quarter). */ + size: string; + /** Rows under an opt-in switch sit in their own group on the slide. */ + optIn?: boolean; +}; + +export const multiplierRows: MultiplierRow[] = [ + { + label: "Government consumption", + q1: 1.01, + q4: 1.02, + q12: 1.04, + obr: 0.6, + obrLabel: "0.6, fading", + display: "1.01 / 1.02 / 1.04", + size: "+£1.25bn a quarter of real spending", + }, + { + label: "Income tax, basic rate +1p", + q1: 0.1, + q4: 0.21, + q12: 0.37, + obr: 0.3, + obrLabel: "0.3, fading", + display: "0.10 / 0.21 / 0.37", + size: "£1.725bn a quarter of revenue", + }, + { + label: "VAT +1pp", + q1: 0.013, + q4: 0.026, + q12: 0.043, + obr: 0.35, + obrLabel: "0.35, fading", + display: "0.013 / 0.026 / 0.043", + size: "£2.2bn a quarter of revenue", + }, + { + label: "VAT +1pp", + setting: "Price pass-through on", + q1: 0.175, + q4: 0.345, + q12: 0.638, + obr: 0.35, + obrLabel: "0.35, fading", + display: "0.175 / 0.345 / 0.638", + size: "The same £2.2bn a quarter", + optIn: true, + }, + { + label: "Government investment", + setting: "Investment closure on", + q1: 1.03, + q4: 0.97, + q12: 0.97, + obr: 1.0, + obrLabel: "1.0, tapering", + display: "1.03 / 0.97 / 0.97", + size: "+£3bn a quarter", + optIn: true, + }, +]; + +// Income tax +1p on the basic rate, £1,725m a quarter (HMRC ready reckoner, +// June 2025, 2026-27 column, £6.9bn a year / 4), sustained 2025Q1–2027Q4. +// Real GDP change, £m a quarter: results/demo_shocks.json "income_tax", +// rounded to the pound as in demo.md. +export const incomeTax = { + revenuePerQuarter: "£1,725m", + revenuePerYear: "£6.9bn", + // PolicyEngine's static costing of the same 1p, a quarter (README limits + // table, "Household tax multiplier", l.33; demo.md l.44: same ratios). Kept + // for the notes, not shown: the micro-to-macro slide quotes a later vintage + // of the same costing (£6.55bn a year), and one deck shows one figure. + policyEngineRevenuePerQuarter: "£1,616m", + gdpPath: [-161, -227, -285, -335, -381, -420, -454, -482, -507, -528, -548, -565], +}; + +// Corporation tax +5pp under the investment closure (demo.md row 5 and +// "One line on each"); government investment +£3bn a quarter (row 7). +export const corporationTax = { + gdpQ1: 0, + gdpQ4: -78, + gdpQ12: -384, + plateauFraction: "40%", + plateau: "£0.96bn", +}; + +export const capitalSpending = { + size: "£3bn", + gdpQ1: 3075, + gdpQ4: 2901, + gdpQ12: 2903, +}; + +// Bank Rate +1pp for four quarters, peak fall in real GDP (demo.md rows 6 and +// 6b; BoE range from Quarterly Bulletin 1999 Q2, as cited there). +export const bankRate = [ + { label: "Our model, mortgage rate held", value: 0.057, display: "−0.057%", kind: "model" }, + { label: "Our model, mortgage rate follows Bank Rate", value: 0.149, display: "−0.149%", kind: "model" }, + { label: "Bank of England, low end", value: 0.2, display: "−0.2%", kind: "benchmark" }, + { label: "Bank of England, high end", value: 0.35, display: "−0.35%", kind: "benchmark" }, +] as const; + +// The opt-in run moves the mortgage rate at the listing's own pass-through +// (README l.35; monetary_conditioning.md). +export const mortgagePassThrough = "Opt-in: the OBR's own 0.9 pass-through, l.623"; + +// Unemployment rate under the anchored long horizon, model vs EFO +// (site_figures.json "anchored_horizon.lfsur_pct"). Since #74 the forecast +// 16+ population follows the path the EFO implies through l.175, so the +// labour-force identity (l.163) returns the EFO's rate: by construction, not +// a forecast (README "Anchored fit"). Before #74 it drained to 3.75% and 1.05%. +export const unemploymentAnchored = [ + { quarter: "2027Q4", model: 5.07, efo: 5.07 }, + { quarter: "2031Q1", model: 4.17, efo: 4.17 }, +]; + +// Government consumption +£1.25bn a quarter, default closure (demo.md row 1; +// demo_shocks.json "cgg", pair deltas): real GDP and central government net +// borrowing (CGNB), £m at q1 / q4 / q12. Since #75 the shock carries its cash +// cost into nominal spending, so borrowing rises by it; receipts (PSCR) don't +// respond. +export const governmentConsumption = { + gdp: [1266, 1280, 1300], + borrowing: [1336, 1364, 1419], +}; + +// --------------------------------------------------------------------------- +// The macro platform (macro README model table; models/index.html compare +// section, "compared by country, question, reform scoring and run surface"). +// `status` is the macro site's one label per model, verbatim, from the "Where +// each model fails" section of models/index.html at the pinned commit; `level` +// is the colour class the site gives it there (lv-gain, lv-mid, lv-loss). +export type PlatformModel = { + name: string; + /** The name spelled out, under it in the table. */ + gloss?: string; + status: string; + level: "gain" | "mid" | "loss"; + country: string; + answers: string; + scoresReforms: boolean; + /** A qualifier the site's comparison table puts beside its Yes or No. */ + scoresNote?: string; + runs: string; +}; + +export const platformModels: PlatformModel[] = [ + { + name: "PolicyEngine microsimulation", + status: "Exact for implemented rules", + level: "gain", + country: "UK, US", + answers: "Household and population tax-benefit effects", + scoresReforms: true, + runs: "Hosted", + }, + { + name: "OBR emulator", + status: "Anchored, not validated", + level: "loss", + gloss: "Our Python build of the OBR's model", + country: "UK", + answers: "Near-term UK fiscal and macro scenarios", + scoresReforms: true, + runs: "Hosted", + }, + { + name: "BoE SVAR", + status: "Partial replication", + level: "mid", + gloss: "Bank of England structural VAR", + country: "UK", + answers: "What drove the UK economy; short-run forecasts", + scoresReforms: false, + runs: "Hosted", + }, + { + name: "DEFINE-UK", + status: "Partial replication", + level: "mid", + country: "UK", + answers: "UK climate-policy scenario deltas", + scoresReforms: false, + runs: "Local", + }, + { + name: "OG-UK", + status: "Calibrated, no outcome benchmark", + level: "loss", + gloss: "Overlapping generations", + country: "UK", + answers: "Long-run work, saving and capital", + scoresReforms: true, + // The site's comparison table says "Yes, none published" for OG-UK. + scoresNote: "none published", + runs: "Local", + }, + { + name: "FRB/US", + status: "Replicates the Fed's solver", + level: "gain", + gloss: "The Federal Reserve Board's US model", + country: "US", + answers: "US monetary and fiscal scenarios, by quarter", + scoresReforms: false, + runs: "Hosted, raw scenarios", + }, + { + name: "US HANK", + status: "Partial replication", + level: "mid", + gloss: "Heterogeneous-agent New Keynesian", + country: "US", + answers: "How US scenarios spread across household wealth", + scoresReforms: false, + runs: "Hosted, stylized scenarios", + }, +]; + +// Forecast track record (forecasts/scorecard.json and the generated status +// block of forecasts/index.html, last scored 16 Nov 2026). +export const forecastRecord = { + scored: 9, + live: 5, + liveIn68: 4, + retroactive: 4, + outturns: 5, + averageMiss: "0.34pp", + noChangeMiss: "0.47pp", + bias: "−0.33pp", + ranLow: "8 of 9", + rounds: 4, +}; + +// Tool counts at the pinned commit: @mcp.tool functions in mcp_server.py and +// @main.command functions in cli.py (the README's own count of 26 tools is +// stale against the code). +export const access = { mcpTools: 28, cliCommands: 27, publicModels: 7 }; + +// Using the platform from Claude, from the macro site's Use page +// (connect/index.html at the pinned commit): the hosted server URL, where to +// add it, the Claude Code command and one of the page's example prompts. The +// tool chain is from mcp_server.py: score_reform runs through start_job on +// the hosted server, get_job_result polls it and format_score_report renders +// it; score_reform(model="obr") returns the costing and GDP, consumption and +// investment. +export const claudeFlow = { + url: "https://policyengine--policyengine-macro-mcp-serve.modal.run/mcp", + settingsPath: "Settings → Connectors → Add custom connector", + claudeCode: + "claude mcp add --transport http policyengine-macro https://policyengine--policyengine-macro-mcp-serve.modal.run/mcp", + prompt: "Score raising the UK basic rate of income tax to 21p.", + tools: ["start_job", "score_reform", "get_job_result", "format_score_report"], +}; + +// The OBR bridge's own benchmark (capabilities.py): static costing of a 1p +// basic-rate rise against HMRC's ready reckoner, 2026-27. +export const bridgeBenchmark = { + policyEngine: "£6.55bn", + hmrc: "£6.9bn", + gap: "5.1% below", +}; + +// The hosted MCP server's OBR pin (integration/pyproject.toml at the macro +// commit above). GitHub's compare view puts it 21 commits behind 0e44ec87, +// before #70 (VAT price pass-through), #71, #74 and #75; hosted obr_shock +// exposes no overlay parameter. +export const hostedObrPin = "2965e82"; + +/** Pages the live-site slide can load into its frame. */ +export const liveSiteViews = [ + { label: "Home", path: "/" }, + { label: "Models", path: "/models" }, + { label: "Compare", path: "/models/compare" }, + { label: "OBR model", path: "/obr" }, + { label: "OBR validation", path: "/obr/validation" }, + { label: "Forecasts", path: "/forecasts" }, +]; + +// Thibault's review of September 2026 (53 points) and our check of it, as +// written up in docs/published_model_review.md. The ratings are counted from +// that doc's summary table: 6 High, 25 Mid, 22 Low. +export const thibRatings = { high: 6, mid: 25, low: 22 }; diff --git a/slideshows/nef-2026/module-links.json b/slideshows/nef-2026/module-links.json new file mode 100644 index 00000000..890bffbd --- /dev/null +++ b/slideshows/nef-2026/module-links.json @@ -0,0 +1,230 @@ +{ + "note": "matrix[i][j]: equations in module j that use a variable module i determines", + "order": [ + "GDP and output", + "Consumption", + "Investment and inventories", + "Labour market", + "Exports", + "Imports", + "Balance of payments", + "North Sea oil", + "Prices and wages", + "Income accounts", + "Public sector", + "Finance and balance sheets" + ], + "matrix": [ + [ + 0, + 0, + 1, + 1, + 0, + 0, + 3, + 1, + 16, + 5, + 0, + 11 + ], + [ + 2, + 0, + 2, + 0, + 0, + 3, + 0, + 0, + 1, + 1, + 0, + 3 + ], + [ + 3, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 2, + 2, + 4, + 3 + ], + [ + 3, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 7, + 1, + 2, + 2 + ], + [ + 1, + 0, + 0, + 0, + 0, + 3, + 1, + 0, + 1, + 0, + 0, + 1 + ], + [ + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1 + ], + [ + 3, + 0, + 0, + 0, + 1, + 0, + 0, + 3, + 8, + 5, + 3, + 3 + ], + [ + 1, + 0, + 0, + 0, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 1, + 5, + 6, + 1, + 2, + 3, + 0, + 1, + 0, + 3, + 1, + 1 + ], + [ + 3, + 2, + 0, + 0, + 0, + 0, + 4, + 0, + 10, + 0, + 2, + 2 + ], + [ + 7, + 0, + 2, + 0, + 0, + 5, + 1, + 0, + 1, + 7, + 0, + 0 + ], + [ + 0, + 3, + 2, + 0, + 0, + 0, + 4, + 0, + 1, + 7, + 1, + 0 + ] + ], + "groupNote": "groupMatrix[i][j]: equations in group j that use a variable group i determines", + "groups": { + "Demand": [ + "Consumption", + "Investment and inventories", + "Exports", + "Imports", + "GDP and output" + ], + "Supply and prices": [ + "Labour market", + "Prices and wages", + "North Sea oil" + ], + "Income and sectors": [ + "Income accounts", + "Public sector", + "Balance of payments", + "Finance and balance sheets" + ] + }, + "groupOrder": [ + "Demand", + "Supply and prices", + "Income and sectors" + ], + "groupMatrix": [ + [ + 0, + 19, + 32 + ], + [ + 21, + 0, + 9 + ], + [ + 24, + 22, + 0 + ] + ] +} diff --git a/slideshows/nef-2026/module-links.py b/slideshows/nef-2026/module-links.py new file mode 100644 index 00000000..4bc8262e --- /dev/null +++ b/slideshows/nef-2026/module-links.py @@ -0,0 +1,160 @@ +"""Count the links between the modules on the NEF deck's module slide. + +Usage: python module-links.py /path/to/obr-macroeconomic-model module-links.json + +For each pair of modules it counts the equations in the target module whose +right-hand side uses a variable that the source module determines (a +left-hand side there). Lagged terms count; commented-out lines are skipped. +Equations are read with the model repo's own parser +(obr_macro/transpiler.py), and each belongs to the module of the listing +section it sits under (the mapping is in MODULE_OF, and in content.ts). A +variable defined in more than one section belongs to the first. + +The slide draws the modules in three groups (GROUPS). The group matrix counts, +for each pair of groups, the equations in the target group whose right-hand +side uses a variable any module of the source group determines; an equation +counts once, however many of the source group's modules it draws on. +""" + +import importlib.util +import json +import re +import sys +from pathlib import Path + +MODULE_OF = { + "Group 1:": "Consumption", + "Group 2:": "Investment and inventories", + "Group 3:": "Investment and inventories", + "Group 4:": "Labour market", + "Group 5:": "Exports", + "Group 6:": "Imports", + "Group 7:": "Prices and wages", + "Group 8:": "North Sea oil", + "Group 9:": "Public sector", + "Group 10:": "Public sector", + "Group 11:": "Balance of payments", + "Group 12:": "Public sector", + "Group 14:": "Finance and balance sheets", + "Group 15:": "Income accounts", + "Group 16:": "GDP and output", + "Market sector GVA satellite": "GDP and output", + "Group 18:": "Finance and balance sheets", +} +ORDER = [ + "GDP and output", + "Consumption", + "Investment and inventories", + "Labour market", + "Exports", + "Imports", + "Balance of payments", + "North Sea oil", + "Prices and wages", + "Income accounts", + "Public sector", + "Finance and balance sheets", +] +GROUPS = { + "Demand": [ + "Consumption", + "Investment and inventories", + "Exports", + "Imports", + "GDP and output", + ], + "Supply and prices": [ + "Labour market", + "Prices and wages", + "North Sea oil", + ], + "Income and sectors": [ + "Income accounts", + "Public sector", + "Balance of payments", + "Finance and balance sheets", + ], +} +GROUP_OF = {module: group for group, modules in GROUPS.items() for module in modules} +assert sorted(GROUP_OF) == sorted(ORDER) +HEADER = re.compile(r"^'\s*(Group \d+:|Market sector GVA satellite)") +NAME = re.compile(r"[A-Za-z_][A-Za-z0-9_]*") + + +def main(repo: str, out: str) -> None: + root = Path(repo) + spec = importlib.util.spec_from_file_location( + "transpiler", root / "obr_macro" / "transpiler.py" + ) + module = importlib.util.module_from_spec(spec) + sys.modules["transpiler"] = module + spec.loader.exec_module(module) + transpiler = module.EViewsTranspiler() + + listing = root / "obr_macro" / "_data" / "obr_model_code_october_2025.txt" + equations = [] + current, buffer = None, "" + for line in listing.read_text().split("\n"): + line = line.strip() + if line.startswith("'"): + header = HEADER.match(line) + if header: + current = MODULE_OF[header.group(1)] + continue + buffer += " " + line + if buffer.count("(") == buffer.count(")"): + if buffer.strip(): + equation = transpiler.parse_equation(buffer.strip()) + if equation: + equations.append((current, equation.lhs, equation.rhs)) + buffer = "" + assert len(equations) == 372, len(equations) + + def lhs_variable(lhs: str): + names = [ + name + for name in NAME.findall(lhs) + if name.lower() not in ("dlog", "d", "log", "identity") + ] + return names[0].upper() if names else None + + owner = {} + for mod, lhs, _ in equations: + variable = lhs_variable(lhs) + if variable and variable not in owner: + owner[variable] = mod + + counts = {a: {b: 0 for b in ORDER} for a in ORDER} + for mod, _, rhs in equations: + used = {name.upper() for name in NAME.findall(rhs)} + for source in {owner[u] for u in used if u in owner and owner[u] != mod}: + counts[source][mod] += 1 + + group_counts = {a: {b: 0 for b in GROUPS} for a in GROUPS} + for mod, _, rhs in equations: + used = {name.upper() for name in NAME.findall(rhs)} + target = GROUP_OF[mod] + for source in {GROUP_OF[owner[u]] for u in used if u in owner} - {target}: + group_counts[source][target] += 1 + + Path(out).write_text( + json.dumps( + { + "note": "matrix[i][j]: equations in module j that use a variable module i determines", + "order": ORDER, + "matrix": [[counts[a][b] for b in ORDER] for a in ORDER], + "groupNote": "groupMatrix[i][j]: equations in group j that use a variable group i determines", + "groups": GROUPS, + "groupOrder": list(GROUPS), + "groupMatrix": [ + [group_counts[a][b] for b in GROUPS] for a in GROUPS + ], + }, + indent=2, + ) + + "\n" + ) + + +if __name__ == "__main__": + main(sys.argv[1], sys.argv[2]) diff --git a/slideshows/nef-2026/slides/BuildScope.tsx b/slideshows/nef-2026/slides/BuildScope.tsx new file mode 100644 index 00000000..dfb64ad0 --- /dev/null +++ b/slideshows/nef-2026/slides/BuildScope.tsx @@ -0,0 +1,81 @@ +"use client"; + +import { useLayoutEffect, useRef, type CSSProperties, type ReactNode } from "react"; +import { useSearchParams } from "next/navigation"; +import { useSlideshowContextSafe } from "@/components/core/SlideshowContext"; +import { isExportMode } from "@/lib/slide-url"; + +/** + * A slide body that knows its build step and keeps clear of the footer. + * + * Builds: elements inside carry `data-step="N"`; deck.module.css hides those + * above the current step and animates each in when its step arrives. An + * export shows every step, so a slide with builds is one complete page in + * the PDF (`exportBuilds: 1`). + * + * Fit: the body's sizes are all in em, so if its content is taller than the + * space above the footer (a short window), `--fit` shrinks the base size + * until it fits. Hidden steps keep their place, so the fit doesn't change + * between steps. + */ +export default function BuildScope({ + className, + style, + children, +}: { + className?: string; + style?: CSSProperties; + children: ReactNode; +}) { + const context = useSlideshowContextSafe(); + const exporting = isExportMode(useSearchParams()); + const build = exporting || !context ? "all" : String(context.buildStep); + const body = useRef(null); + + useLayoutEffect(() => { + const element = body.current; + if (!element) return; + const fit = () => { + // A slide that isn't shown has no height: fit it when it appears. + if (element.clientHeight === 0) return; + // Layout heights, which an entrance animation's transform doesn't move + // (scrollHeight would count it and shrink a slide that fits). + const room = + element.clientHeight - parseFloat(getComputedStyle(element).paddingBottom || "0"); + const content = () => + Array.from(element.children).reduce( + (sum, child) => sum + (child as HTMLElement).offsetHeight, + 0, + ); + let scale = 1; + element.style.setProperty("--fit", "1"); + let before = content(); + while (before > room + 1 && scale > 0.6) { + scale -= 0.03; + element.style.setProperty("--fit", scale.toFixed(2)); + const after = content(); + // Content that doesn't follow the base size (the module map sizes + // itself from the window) can't be fitted this way: leave it. + if (after >= before) { + element.style.setProperty("--fit", "1"); + break; + } + before = after; + } + }; + fit(); + // Fit again whenever the space or the content changes size (a resized + // window, styles or fonts arriving after the first paint). + const observer = new ResizeObserver(fit); + observer.observe(element); + for (const child of Array.from(element.children)) observer.observe(child); + document.fonts?.ready.then(fit); + return () => observer.disconnect(); + }, []); + + return ( +
+ {children} +
+ ); +} diff --git a/slideshows/nef-2026/slides/SiteEmbed.tsx b/slideshows/nef-2026/slides/SiteEmbed.tsx new file mode 100644 index 00000000..9cfd57d7 --- /dev/null +++ b/slideshows/nef-2026/slides/SiteEmbed.tsx @@ -0,0 +1,87 @@ +"use client"; + +import { useState } from "react"; +import { + IconArrowsMaximize, + IconArrowsMinimize, + IconExternalLink, + type Icon, +} from "@tabler/icons-react"; +import styles from "./embed.module.css"; + +/** + * The macro site, live on the slide. Expand stretches the same frame over the + * whole screen, so the page it shows is kept when it + * goes back to the slide. Clicks in the frame go to the site, and so do + * the arrow keys until the slide is clicked outside it. The view buttons in + * the bar load one of the site's pages into the same frame. + */ +export type SiteView = { + label: string; + icon: Icon; + /** The page path to load, such as "/models/compare". */ + path: string; +}; + +export default function SiteEmbed({ + href, + title, + views = [], +}: { + href: string; + title: string; + /** Buttons that open a page of the site in the frame. */ + views?: SiteView[]; +}) { + const [expanded, setExpanded] = useState(false); + const [src, setSrc] = useState(href); + // Bumped on every view button, so a second click on the same view reloads it. + const [load, setLoad] = useState(0); + const ToggleIcon = expanded ? IconArrowsMinimize : IconArrowsMaximize; + + return ( +
event.stopPropagation()} + > +
+ {views.length > 0 && ( +
+ {views.map((view) => ( + + ))} +
+ )} + + + +
+