macroframe-forecast: a Python package to assist with macroframework forecasting
This package is based on the following papers:
- A Python Package to Assist Macroframework Forecasting: Concepts and Examples (2025).
- Smooth Forecast Reconciliation (2024)
- Systematizing Macroframework Forecasting: High-Dimensional Conditional Forecasting with Accounting Identities (2023)
Documentation
Please refer to this link for documentation.
Installation
To install the macroframe-forecast package, run the following from the repository root:
pip install macroframe-forecast
Quick start
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from macroframe_forecast import MFF
# true data
df_true = pd.DataFrame({
'var1': np.random.randn(30), # 100 random values from normal distribution
'var2': np.random.randn(30)
})
df_true['sum'] = df_true['var1'] + df_true['var2']
# input dataframe
df = df_true.copy()
fh = 5
df.iloc[-fh:, 1:] = np.nan
# apply MFF
m = MFF(df, equality_constraints=['var1_? + var2_? - sum_?'])
df2 = m.fit()
# plots results
fig,axes = plt.subplots(3,1,sharey=True, figsize=(9,9))
axes[0].plot(df2['var2'], label='forecasted var2')
axes[0].plot(df_true['var2'], label='true var2')
axes[0].legend()
axes[1].plot(df2['sum'], label='forecasted sum')
axes[1].plot(df_true['sum'], label='true sum')
axes[1].legend()
axes[2].plot( df2['var1'] + df2['var2'] - df2['sum'], label='summation error')
axes[2].legend()
Disclaimer
Reuse of this tool and IMF information does not imply any endorsement of the research and/or product. Any research presented should not be reported as representing the views of the IMF, its Executive Board, or member governments.
Metadata
Release files for macroframe-forecast 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| macroframe_forecast-0.1.6.tar.gz | 148.5 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| macroframe_forecast-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 176.7 kB
Release files / macroframe_forecast-0.1.6.tar.gz
| Download URL | macroframe_forecast-0.1.6.tar.gz |
|---|---|
| Size | 148.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c304b80d7ebd2c48ead88c27b2e5b316263f2c1383c070b5dd6fdcd48946db2
|
|
BLAKE2b-256 checksum How to use checksums |
49fb13887c05ae76b1f10aab95d49bd1bb99490e945a7e774a35ea7efd936de7
|
| 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 Dec 19, 2025.
Transparency logRelease files / macroframe_forecast-0.1.6-py3-none-any.whl
| Download URL | macroframe_forecast-0.1.6-py3-none-any.whl |
|---|---|
| Size | 28.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
566cf7e2fdfc222db6006b9d005e577f70385893d103324b959a29e10f17779a
|
|
BLAKE2b-256 checksum How to use checksums |
0544d901ccb1778d44f87f7123be467de65cc0f731d5ccafc5fd367a33c5c436
|
| 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 Dec 19, 2025.
Transparency logSecurity for macroframe-forecast 0.1.6
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for macroframe_forecast-0.1.6.tar.gz
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 Dec 19, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.