Skip to main content

Macroframework forecasting with accounting identities

Project description

macroframe-forecast: a Python package to assist with macroframework forecasting

!pypi Downloads

This package is based on the following papers:

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

macroframe_forecast-0.1.6.tar.gz (148.5 kB view details)

Uploaded Source

Built Distribution

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

macroframe_forecast-0.1.6-py3-none-any.whl (28.2 kB view details)

Uploaded Python 3

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

Hashes for macroframe_forecast-0.1.6.tar.gz
Algorithm Hash digest
SHA256 0c304b80d7ebd2c48ead88c27b2e5b316263f2c1383c070b5dd6fdcd48946db2
MD5 d3177a538d184fa8cadc4b2000bd77f7
BLAKE2b-256 49fb13887c05ae76b1f10aab95d49bd1bb99490e945a7e774a35ea7efd936de7

See more details on using hashes here.

Provenance

The following attestation bundles were made for macroframe_forecast-0.1.6.tar.gz:

Publisher: release.yml on sakaiando/macroframe-forecast

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

File details

Details for the file macroframe_forecast-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for macroframe_forecast-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 566cf7e2fdfc222db6006b9d005e577f70385893d103324b959a29e10f17779a
MD5 4eeb7f42401901a1375833248c9916fe
BLAKE2b-256 0544d901ccb1778d44f87f7123be467de65cc0f731d5ccafc5fd367a33c5c436

See more details on using hashes here.

Provenance

The following attestation bundles were made for macroframe_forecast-0.1.6-py3-none-any.whl:

Publisher: release.yml on sakaiando/macroframe-forecast

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