Skip to main content

A package for Forecast Evaluation

Project description

PyPI PyPI - Downloads

Forecast Evaluation Package

A Python package for analysing and visualising economic forecast data.

Installation

Installing from PyPI

pip install forecast_evaluation

Installing the development version

git clone https://github.com/bank-of-england/forecast_evaluation.git
cd forecast_evaluation
pip install -e .

Documentation

The package documentation can be found here with examples on how to use the package in this notebook.

Features

The package contains tools to inspect the accuracy, unbiasedness and efficiency of economic forecasts. It includes visualisation tools, statistical tests and accuracy metrics commonly used for forecast evaluation. In handles both point forecasts (with the ForecastData object) and density forecasts (with the DensityForecastData object).

Visualisation for forecasts, outturns and errors:

  • Forecast vintages plot
  • Accuracy and bias plots (average and rolling averages)
  • Hedgehog plots
  • Outturn revisions
  • Forecast error distributions
  • Forecast error correlation
  • Radar plots

Statistical tests

  • Accuracy analysis (Diebold-Mariano test)
  • Bias analysis (Mincer-Zarnowitz Regression)
  • Weak Efficiency analysis (Revision predictability)
  • Strong Efficiency analysis (Blanchard-Leigh regression)
  • Testing correlation between forecast revisions and forecast errors
  • Rolling-window analysis of most tests with fluctuation tests.

Accuracy metrics available

  • Root mean square error
  • Mean absolute error
  • Median absolute error

All of the above features can be explored interactively in a dashboard.

Loading data

Data format

The forecasts should be in a pandas dataframe format with the following structure:

            date vintage_date variable       source frequency  forecast_horizon  value
0     2014-12-31   2015-03-31      gdp        BVAR         Q                -1    100
1     2015-03-31   2015-03-31      gdp        BVAR         Q                 0    101
2     2015-06-30   2015-03-31      gdp        BVAR         Q                 1    102
3     2015-09-30   2015-03-31      gdp        BVAR         Q                 2    103

Outturns follow the same structure but do not contain a source column.

Creating a ForecastData instance

The package's main object is the ForecastData class which holds the outturns, forecasts, transformed forecasts and forecast errors. You can create an instance of this class with:

import forecast_evaluation as fe

forecast_data = fe.ForecastData(forecasts_data=forecasts_dataframe, outturns_data=outturns_dataframe)

The package also comes with built-in data used in the Bank of England 2026 Forecast Evaluation Report which can be loaded with:

forecast_data = fe.ForecastData(load_fer=True) 

The forecast_data object has methods to filter, analyse and visualise the data and resulting analysis. These are illustrated in the example notebook.

Results from the Bank of England 2026 Forecast Evaluation Macro Technical Paper can also be replicated with this notebook.

Run the dashboard

To make visualisation of forecasts and their properties easier, the package includes a dashboard. Once a ForecastData object has been created the dashboard can be run with:

forecast_data.run_dashboard()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

forecast_evaluation-0.0.11.tar.gz (510.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

forecast_evaluation-0.0.11-py3-none-any.whl (523.3 kB view details)

Uploaded Python 3

File details

Details for the file forecast_evaluation-0.0.11.tar.gz.

File metadata

  • Download URL: forecast_evaluation-0.0.11.tar.gz
  • Upload date:
  • Size: 510.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for forecast_evaluation-0.0.11.tar.gz
Algorithm Hash digest
SHA256 374c1d57347d2bead18e1cde087b1e42147d5e5f2a3c55de993eef48009d54d4
MD5 6430ba0c8b54caccf31251eb880ac294
BLAKE2b-256 56af33d08fcdb47fa90302e8b95bdc34369a952c9647b7a0f4f12e263a401eca

See more details on using hashes here.

Provenance

The following attestation bundles were made for forecast_evaluation-0.0.11.tar.gz:

Publisher: publish.yml on bank-of-england/forecast_evaluation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file forecast_evaluation-0.0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for forecast_evaluation-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 10c4f196397a8e7547d1bb6aa157c08c9a2736717cc400c9272cc7365baf7e9c
MD5 6eb9ac69323ee23778b9507981b5d8e8
BLAKE2b-256 2646a785cdf1f28a9de6d91d87d668505b9b4f34faab8b688f798e5f55a248ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for forecast_evaluation-0.0.11-py3-none-any.whl:

Publisher: publish.yml on bank-of-england/forecast_evaluation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page