Skip to main content

A tool to solve and manage dynamic economic models

Project description

ModelFlow

A Python toolkit to manage models

The easy way to start is here Binder.

This will start ModelFlow as an online Jupyter notebook. Select one of the notebooks (files with the extension .ipynb). Some of the notebooks are ModelFlow related. Other implement different model

  • FRBUS will start the FRB/US model from the Federal reserve board.
  • Q-JEM will start the Quarterly Japanese Economic Model from Bank of Japan
  • ADAM will start the Anual Danish Aggregate Model for the Danish Statistical agency.
  • Solow will implement a simple textybook Solow model.

You can also look at the python files of the system. Located at the modelflow/ folder

Alternative look at the getting started section later in this file. It explains how to run ModelFlow localy.

The Pandas library is a great library to handle all kinds of datamanipulation and transformations.

However when it comes to models which contains lags or models which requires solving simultanous equations, Pandas is not quite helpful.

ModelFlow extends Pandas to handle a range of such models. And they can be large.

It requires you to specify the model specified as equations (the business logic) and place the data in a Pandas DataFrame. ModelFlow allows the model to meet the data and return the result as a new DataFrame.

A number of analytical tools for model and result analytic helps to understand the model and its results.

The user can extend and modify the tools to her or his needs.

Onboarding models and combining models from different sources. Creating a Macro prudential model often entails recycling several models specified in different ways: Excel, Latex, Dynare, Python or other languages. Python's ecosystem makes it possible to transform many different models into ModelFlow models or to wrap them into functions which can be called from ModelFlow models.

Models can be specified in a high level Business logic language (a Domain Specific language). This allows the formulation of a model in a concise and expressive language which is close to the economic of the model. The user can concentrate on the economic or financial content - not the coding of the solution. The code for solving the model is generated by the tool. Then you can solve the simultaneous (or non-simultaneous model) in an efficient way.

Introduction

ModelFlow is written in Python. Python comes "batteries included" and is the basis of a very rich ecosystem, which consists of a wide array of libraries. ModelFlow is just another library. It supplements the existing libraries regarding modeling language and solving and allows the use of Python as a model management framework.

Data handling and wrangling is done in the Pandas library. This library is the Swiss army knife of data science in Python. It can import and export data to most systems and it is very powerful in manipulating and transforming data. The core element of Pandas is the Dataframe. A Dataframe is a two-dimensional tabular data structure. Each column consists of cells of the same type -- it can be a number, a string, a matrix or another Python data object.This includes matrices and other dataframes. Each row is indexed. The index can basically be any type of variable including dates, which is especially relevant for economic and financial models.

ModelFlow gives the user tools for more than solving models. This includes:

  • Visualization and comparison of results

  • Integration of models from different sources

  • Analyze the logical structure of a model. By applying graph theory, ModelFlow can find data lineage, find a suitable calculating sequence and trace causes of changes through the calculations.

  • Inverting the model to calculating the necessary instruments to achieve a desired target.

  • Calculating the attributions from input to the results of a model.

  • Calculating the attribution from input to the result of each formula.

  • Finding and calculating partial derivatives of formulas

  • Integrating user defined python functions in the Business logic language (like optimization, calculating risk weights or to make a matrices consistent with the RAS algorithm )

  • Wrap matlab models so they can be used in the Business logic language.

  • Speed up solving using "Just in time compilation"

  • Analyze the model structure through tools from graph theory

  • Handle large models. 1,000,000 formulas is not a problem.

  • Integrate model management in Jupyter notebooks for agile and user friendly model use

The core code of ModelFlow is small and documented. Thus it can easily be modified and expanded to the specific need of the user. ModelFlow is a toolset. It can handle models, which conform to the tools.

If you need a feature or have a model which can't be handled in ModelFlow, you are encouraged to improve ModelFlow. Please share the improvement, other users may have the same need, or can be inspired by your work.

Also bear in mind that ModelFlow is experimental. It is provided ”as is”, without any representation or warranty of any kind either express or implied.

Getting started

You need Python 3.7+ with asssociated libraries. The easy way is to install Anaconda Python is to download the distribution from https://www.anaconda.com/distribution

Now you can install ModelFlow by running a command window from the Anaconda prompt and execute theese commands

conda install modelflow -c ibh -c defaults -c conda-forge

You will find the anaconda prompt by searching "anaconda" in the start menu search field

Try out one of the workbooks. to do this you:

click on the Adaconda prompth in the Anaconda folder
cd <The location you have downloaded the workbooks>
jupyter notebook

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

ModelFlowIb-2.14-py3-none-any.whl (1.0 MB view details)

Uploaded Python 3

File details

Details for the file ModelFlowIb-2.14-py3-none-any.whl.

File metadata

  • Download URL: ModelFlowIb-2.14-py3-none-any.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for ModelFlowIb-2.14-py3-none-any.whl
Algorithm Hash digest
SHA256 c785b362fe41d4226d8b8395e5984f1ab0394ab4b91b1fdbcb3d91da233185d4
MD5 5b682b6d50cbc29477ceeaccc7206b82
BLAKE2b-256 b9690a4b4fbf07a27430f79ff004ff7da369123678b680017332019b673ad286

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page