Skip to main content

Stock-Flow Consistent (SFC) model generation

Project description

Introduction

Creation and solution of stock-flow consistent (SFC) models. Currently under construction.

At present, the module sfc_models.iterative_machie_generator.py imports a text block of equations, and then writes a python module that implements that system of equations.

Although such functionality is nice, the objective is to build modules that generate the systems of equations. That is, the user will specify the high-level sector description of the economy (which may include multiple countries), and the high-level description will be parsed to generate the low-level equations.

For another take on SFC models in Python see: https://github.com/kennt/monetary-economics

Developed under Python 3.4, and is compatible with Python 2.7.

Sub-package: gl_book

The subpackage sfc_models.gl_book contains code to generate models from the text “Monetary Economics” by Wynne Godley and Marc Lavoie. Since the ultimate objective is to generate the equations algorithmically, these models are only used for comparative purposes.

The previously mentioned GitHub package by “kennt” consists of well-documented solutions of those models.

Solution Method

The single-period solution of a SFC model relies on market-clearing (not necessarily relying on price adjustments, unlike mainstream models). Market clearing relies on solving many simultaneous equations.

At present, the machine-generated code uses an iterative approach to solve x = f(x) (where x is a vector). We just passing an initial guess vector trhough f(x) and hope it converges.

This works for the simple models tested so far. The objective is to augment this by a brute-force search technique that relies upon economic intuition to reduce the dimension of the search space. The margins in this file are too small to write a proof of this technique.

Dependencies

  • matplotlib: for plots in examples. (May be required later.)

Documentation will be placed in the “docs” directory.

Examples are in the “examples” directory.

(Please note that setup.py - which is invoked by pip install - currently does not install those directories. The user will need to go to GitHub to get them, as well as the unit tests (and doctests) found in the tests/ directory.)

The test coverage on the “master” branch is 100%, and the objective is to hold that standard. (There are some sections that are effectively untestable, and there appears to be issues with some lines that are undoubtedly hit as being marked as unreached; they have been eliminated with:: # pragma: no cover

License/Disclaimer

Copyright 2016 Brian Romanchuk

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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

sfc_models-0.2.zip (47.2 kB view details)

Uploaded Source

Built Distribution

sfc_models-0.2-py2.py3-none-any.whl (22.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file sfc_models-0.2.zip.

File metadata

  • Download URL: sfc_models-0.2.zip
  • Upload date:
  • Size: 47.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sfc_models-0.2.zip
Algorithm Hash digest
SHA256 0fa8a925e674c41eabb9e9173329eb5e6359a7c61f112b6025ca8b57388725c9
MD5 3c9a40b693519db3e2b3d2baa3d011b1
BLAKE2b-256 b1b103e34a6acd9ae60179028a71034c67a96a6e85aec27c2c3097656c14b7f0

See more details on using hashes here.

File details

Details for the file sfc_models-0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for sfc_models-0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 72e8076f6c3907f864f60b6c8aa24bc48338b180f1eeb27912062e01d180f224
MD5 16dcdbd9f0e0c2c41b7e62cb137021e5
BLAKE2b-256 02e9f77c81ff091db056641f90fb1ca2989c92fecd8c03bed88ba90a24c11ffc

See more details on using hashes here.

Supported by

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