Macroframework forecasting with accounting identities
Project description
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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file macroframe_forecast-0.1.6.tar.gz.
File metadata
- Download URL: macroframe_forecast-0.1.6.tar.gz
- Upload date:
- Size: 148.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c304b80d7ebd2c48ead88c27b2e5b316263f2c1383c070b5dd6fdcd48946db2
|
|
| MD5 |
d3177a538d184fa8cadc4b2000bd77f7
|
|
| BLAKE2b-256 |
49fb13887c05ae76b1f10aab95d49bd1bb99490e945a7e774a35ea7efd936de7
|
Provenance
The following attestation bundles were made for macroframe_forecast-0.1.6.tar.gz:
Publisher:
release.yml on sakaiando/macroframe-forecast
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
macroframe_forecast-0.1.6.tar.gz -
Subject digest:
0c304b80d7ebd2c48ead88c27b2e5b316263f2c1383c070b5dd6fdcd48946db2 - Sigstore transparency entry: 773396947
- Sigstore integration time:
-
Permalink:
sakaiando/macroframe-forecast@26e7210e615f9458581e9c804f72cdd73c12b6b4 -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/sakaiando
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@26e7210e615f9458581e9c804f72cdd73c12b6b4 -
Trigger Event:
release
-
Statement type:
File details
Details for the file macroframe_forecast-0.1.6-py3-none-any.whl.
File metadata
- Download URL: macroframe_forecast-0.1.6-py3-none-any.whl
- Upload date:
- Size: 28.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
566cf7e2fdfc222db6006b9d005e577f70385893d103324b959a29e10f17779a
|
|
| MD5 |
4eeb7f42401901a1375833248c9916fe
|
|
| BLAKE2b-256 |
0544d901ccb1778d44f87f7123be467de65cc0f731d5ccafc5fd367a33c5c436
|
Provenance
The following attestation bundles were made for macroframe_forecast-0.1.6-py3-none-any.whl:
Publisher:
release.yml on sakaiando/macroframe-forecast
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
macroframe_forecast-0.1.6-py3-none-any.whl -
Subject digest:
566cf7e2fdfc222db6006b9d005e577f70385893d103324b959a29e10f17779a - Sigstore transparency entry: 773396948
- Sigstore integration time:
-
Permalink:
sakaiando/macroframe-forecast@26e7210e615f9458581e9c804f72cdd73c12b6b4 -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/sakaiando
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@26e7210e615f9458581e9c804f72cdd73c12b6b4 -
Trigger Event:
release
-
Statement type: