news_decomp
Installation
# Install the published package.
pip install news-decomp
# Clone the repository for development.
git clone https://github.com/bank-of-england/news-decomp
cd news-decomp
# Install the package with development dependencies.
pip install -e ".[dev,docs,notebooks]"
Quick start
Run the sample-data example:
python -m examples.example_data
Calculate forecast metrics and draw charts:
python -m examples.example_analysis
Build the nowcast report:
python -m examples.example_report
Or open the interactive Marimo example:
marimo edit examples/example_data_marimo.py
The Marimo example is also published in the documentation. Regenerate its Markdown page after changing the app:
python docs/convert_notebooks.py
The decompositions table
The package consumes one long-format table. Each row records one additive
component of either a forecast level or a forecast revision. Every row must
satisfy the schema in src/news_decomp/schema.py; see
news_decomp.md for the complete data contract.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
variable |
str | no | Target variable, such as "gdpkp" or "y". |
date |
Timestamp | no | End of the target period, such as 2026-06-30 for 2026-Q2. |
forecast_horizon |
int | no | Steps from the target: 0 means nowcast, 1 means one step ahead, and so on. |
frequency |
str | no | Target frequency: "Q" for quarterly or "M" for monthly. |
source |
str | no | Model or label that produced the forecast. |
vintage_date |
Timestamp | no | Date at which the decomposition was computed. |
base_vintage_date |
Timestamp | yes | Earlier vintage for revision rows; NaT for level rows. |
decomposition |
str | no | "level" for a forecast level or "revision" for a change between vintages. |
component |
str | no | Contributor name, such as a regressor, "intercept", own lag, or "residual". |
revision_source |
str | yes | Revision part: "news", "reestimation", or "interaction". Blank (NaN) for level rows. |
contribution |
float | no | Signed additive contribution. Components sum to the level or revision. |
weight |
float | yes | Linear-model weight $w_i$ when the factorisation $\text{contribution} = w_i \times \text{news}_i$ applies. |
news |
float | yes | Surprise $x_i - \mathbb{E}[x_i \mid \Omega_{v_0}]$ for a linear news row. |
forecast_metric |
str | no | Transform used for the forecast, such as "levels", "pop", or "yoy". |
Documentation
- News Decomposition data contract: schema, identities, and worked examples.
- API reference: public classes and methods.
- The
examples/directory contains runnable scripts for simulation, metrics, reports, and Marimo.
Data Classification
Bank of England Data Classification: OFFICIAL BLUE
Release files for news-decomp 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| news_decomp-0.0.7.tar.gz | 34.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| news_decomp-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 67.6 kB
Release files / news_decomp-0.0.7.tar.gz
| Download URL | news_decomp-0.0.7.tar.gz |
|---|---|
| Size | 34.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b622e524f35115cd2f16c72a101a2492e13c941e5790282f422c8f39d5abf9aa
|
|
BLAKE2b-256 checksum How to use checksums |
d36e6af320e9f77ef35ec749938872152bbc379f7bcc37fabeaf9f20e38feab6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.
Transparency logRelease files / news_decomp-0.0.7-py3-none-any.whl
| Download URL | news_decomp-0.0.7-py3-none-any.whl |
|---|---|
| Size | 32.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3b4264a1c17d4f12d64728ad6d6ebfd76387b053bc484a12db9ddc0201280426
|
|
BLAKE2b-256 checksum How to use checksums |
1d00da887feb2f9a897d3a3afba6206b77a8a2a78d5c6d04694740d9f9e53a94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.
Transparency log