Skip to main content

Staggered-Combination MIDAS

Mixed-frequency nowcasting and short-horizon forecasting of quarterly targets (e.g. GDP) from monthly indicators, with forecast combination.

Experimental Python implementation of Moreira (2025)

Read the user manual for the full guide.

Features

  • MIDAS regression with Almon, exponential-Almon, Beta and unrestricted lag polynomials.
  • Quarterly OLS counterpart (OLS / OLSSpec) for hard quarterly indicators, sharing the same forecasting and dummy interface.
  • Direct multi-horizon forecasting: one model per horizon h, fit and stored together.
  • Outlier dummies on the target (dummy_periods) absorbed at the target frequency.
  • End-to-end combination pipeline MidasCombo:
    • Average, inverse-error (mae, mse, rmse) and regression weights across indicators.
    • Rolling-window and discounted-error variants.
    • Combinations of combinations (a ComboSpec can reference other ComboSpecs as sources).
  • NLS estimation of non-linear weight schemes (Almon-exp, Beta).

Project Structure

├── src/nowcast_midas/    # Source code
├── docs/            # Zensical documentation site
├── examples/        # Example scripts
├── tests/midas/     # Unit tests
└── ...

Installation

From PyPi:

pip install nowcast-midas

Dev version:

git clone https://github.com/bank-of-england/nowcast-midas.git
cd nowcast-midas
pip install -e .                      # runtime
pip install -e ".[dev]"               # + test / lint / docs tooling
pip install -e ".[realtime]"          # + real-time (vintage) analysis stack

Python ≥ 3.10.

Quick start

from nowcast_midas import ComboSpec, MidasCombo, MidasSpec, OLSSpec
from nowcast_midas.utils import sample_combo_data

# Simulated mixed-frequency data: three monthly series, one quarterly
# regressor, one quarterly target, plus one injected outlier.
target_df, regressors_df, info = sample_combo_data(n_quarters=60, seed=42)
outlier = info["outlier_date"]

midas_monthly_1 = MidasSpec(
    "monthly_1", method="almon", n_lags=6, dummy_periods=[outlier]
)
midas_monthly_2 = MidasSpec(
    "monthly_2", method="almon", n_lags=6, dummy_periods=[outlier]
)
midas_monthly_3 = MidasSpec(
    "monthly_3", method="unrestricted", n_lags=3, dummy_periods=[outlier]
)
ols_quarterly_1 = OLSSpec("quarterly_1", n_lags=1, dummy_periods=[outlier])

soft = ComboSpec(
    "soft",
    sources=[midas_monthly_1, midas_monthly_2, midas_monthly_3],
    method="mse",  # inverse mean-squared-error weights — see docs/methods/combo.md
    window=8,
    discount_rate=0.95,
)
final = ComboSpec("final", sources=[soft, ols_quarterly_1], method="regression")

model = MidasCombo(combo_specs=final, horizons=3)  # horizons is a COUNT, not an index
model.fit(target=target_df, regressors=regressors_df)

oos = model.forecast()  # long format: one row per (spec, horizon step);
# columns horizon, spec, value, date
print(oos.head())
model.summary(horizon=0)  # prints and returns the text

This is the same example as docs/index.md; runnable end-to-end scripts are in examples/ and rendered in Worked examples.

Selected documentation

Selected examples

Contributing

  • See CONTRIBUTING.md for details on how to contribute to the code.
  • Open an issue with questions or ideas.

Main references

Data Classification

Bank of England Data Classification: OFFICIAL BLUE

Release files for nowcast-midas 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nowcast-midas 0.0.2
File Size Uploaded
nowcast_midas-0.0.2.tar.gz 58.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nowcast-midas 0.0.2
File Interpreter ABI Platform
nowcast_midas-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 120.8 kB

Release files / nowcast_midas-0.0.2.tar.gz

Download URL nowcast_midas-0.0.2.tar.gz
Size 58.0 kB
Tags Source
SHA-256 checksum
How to use checksums
34d84067373f9e9a417e71f526f9e3a7eeb73390e1e67539e70442b79b6efcd6
BLAKE2b-256 checksum
How to use checksums
b19a210a878df7e4d43c344f91ae2695819c507f11a3818e3f45bcd240286a50
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 Sep 3, 2026.

Transparency log

Release files / nowcast_midas-0.0.2-py3-none-any.whl

Download URL nowcast_midas-0.0.2-py3-none-any.whl
Size 62.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8951e621c7d294495ff98490826d2931368c0e9b6468605f7df3b002e2a91600
BLAKE2b-256 checksum
How to use checksums
20c71991c8e684316fbb23bfe47de0d285e687287987d81366affd12acf3f0f6
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 Sep 3, 2026.

Transparency log

Release history Release notifications | RSS feed

0.0.3

2 release files

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page