quantgirluk / fanchart

📦 Python library to create Fan Charts as introduced by the Bank of England in 1996
MIT License
14 stars 2 forks source link

fanchart

PyPI version fury.io Downloads

PyPI license example workflow Documentation Status

Overview

The fanchart library provides functionality to create fan charts in Python.

The term fan chart was coined by the Bank of England in 1996. Since then, the BoE has used these charts to illustrate its forecasts for inflation.

The BoE introduced the fan charts aiming to communicate a more accurate representation of their forecast for medium term inflation. In particular, the charts have two key objectives:

For more details on the history of fan charts visit Fan Charts

Installation

Fanchart is available on pypi and can be installed as follows.

pip install fanchart

Dependencies

Fanchart relies heavily on

Compatibility

Fanchart is tested on Python versions 3.8, 3.9, and 3.10

Getting Started

:exclamation: 📝 Install the latest version of fanchart before starting.

This library provides two main functions fan and fan_single. In order to be able to make our first fan charts with these functions, we need to load some data via the functions.

from fanchart import load_boe_history, load_boe_parameters

history = load_boe_history()
parameters = load_boe_parameters()

After this, we are ready to use our main functions.

    from fanchart import fan

    probs = [0.05, 0.20, 0.35, 0.65,0.80,  0.95]
    fan(pars=parameters, probs=probs, historic=history[history.Date >= '2018'])

    from fanchart import fan_single

    probs = [0.05, 0.20, 0.35, 0.65,0.80,  0.95]
    fan_single(loc=9.53, sigma=1.68, gamma=1.0, probs=probs, kind='pdf')

    from fanchart import fan_single

    probs = [0.05, 0.20, 0.35, 0.65,0.80,  0.95]
    fan_single(loc=9.53, sigma=1.68, gamma=1.0, probs=probs, kind='cdf')

Thanks for Visiting! ✨

Connect with me via:

⭐️ If you like this projet, please give it a star! ⭐️