UK SVAR adapter publishes log-difference YoY as if it were the simple rate

オープン
#208 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@vahid-ahmadi がすでに取り組んでいます。

2026年11月25日 から。

  • #285 @vahid-ahmadi による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
backend, data

調査の方向性

Read integration/src/policyengine_macro/core.py around svar_forecast and the SVAR inflation-incidence tool, then check the upstream boe-var-model forecast helpers and the scorecard treatment of archived rounds. Confirm the conversion for aggregated medians and bands, and decide how scoring should handle older rounds. Done means the forecast and CPI comparison use simple-rate units, with a test matching 100*(P_t/P_{t-4}-1) and a clear basis for archived rounds.

索引モデルが issue の本文から書いたものです。

説明

bug

Problem

The UK SVAR adapter publishes the model's four-quarter log difference as if it were the simple four-quarter rate that ONS, the BoE MPR and the OBR EFO publish.

  • integration/src/policyengine_macro/core.py:1365 (main 153cf41), in svar_forecast: yoy_paths.append(forecast.yoy(np.vstack([tail, path]))). boe_var.forecast.yoy is x_t - x_{t-4} on 100·log levels, which is 100·log(P_t/P_{t-4}). The medians and 68/90 bands go out unchanged as "YoY %".
  • core.py:3850-3851, in the SVAR inflation-incidence tool: svar_cpi_yoy_pct (log basis, from the same path) is differenced against reference_cpi_yoy_pct (a published simple rate). So the gap mixes units with the forecast difference.

The simple rate is above the log rate by about x²/200: +0.04pp at 2.8% CPI, +0.13pp at 5%, +0.5pp at 10%. For 2026 CPI near 3%, that is about 0.03–0.05pp on every archived CPI row on /forecasts, which is small but has a consistent sign. In a 2022-style episode it is about half a point.

Upstream fix

PolicyEngine/boe-var-model adds forecast.yoy_pct and forecast.log_to_simple_pct (draft PR https://github.com/PolicyEngine/boe-var-model/pull/18). The map 100·expm1(x/100) is monotone, so applying it to the aggregated median and band edges gives exactly the bands of the converted paths. There is no need to convert each path.

What the adapter should do (not done here)

  1. In svar_forecast, convert bands with forecast.log_to_simple_pct after aggregating. Fall back to 100*np.expm1(x/100) for older boe_var versions without the helper.
  2. Use the converted CPI value for svar_cpi_yoy_pct at :3850, so the gap at :3851 is simple minus simple.
  3. Archived forecast rounds: leave the vintages as they are (append-only). Add a basis note to rounds before the change, so a scorecard does not mix log-basis and simple-basis errors without flagging it. Alternatively, convert at scoring time. The conversion is exact for medians and bands, so either option is safe.
  4. Add a test: for a known level path, the adapter's YoY must match 100*(P_t/P_{t-4}-1).

Decision for Vahid

Decide whether the scorecard should re-express past SVAR rounds on the simple basis at scoring time (recommended: it is exact and keeps the vintages untouched), or leave them on the log basis with a note.

🤖 Generated with Claude Code

主要言語
HTML
スター
3
フォーク
1
平均マージ
1日 20時間
マージ済み PR(30日)
53

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

PolicyEngine/macro のほかの issue

PolicyEngine/macro の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。