I got a question about a parsing error in the sfc_models package. The error given is:
"NotImplementedError: Non-simple parsing not done"
If this is happening to you, the file equation.py needs to be updated to match the development branch version. Link to the file:
https://github.com/brianr747/SFC_models/blob/development/sfc_models/equation.py
There was a change of behaviour between Python versions 3.4/3.5 and 3.7. The code is now cleaner, and it now works for me on Python versions 3.5 and 3.7.
I have pushed the change to both branches on GitHub, and updated the release version on PyPi (what pip installs) to version 1.0.3.
Note: If you have problems, one way to diagnose problems is to run the unit tests. (Very easy to do from PyCharm.)
(c) Brian Romanchuk 2019
Recent Posts
Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts
Sunday, September 22, 2019
Wednesday, May 29, 2019
Small Platform/sfc_models Update
I just wanted to give a small update on what I am doing. I am currently working on tying the sfc_models framework into econ_platform. This is not adding new modelling functionality, but will make it easier to work with (eventually). For example, the entire set of series generated by a model - including optional solution convergence output and initial steady state solvers - will be loaded into a database, which can be browsed. (Obviously, this assumes some database browsers are developed for econ_platform.
Otherwise, econ_platform is closer to "version 1.0." There are some missing features, but they are of lesser importance, and should be fairly easy to incorporate.
Sunday, May 5, 2019
Python/R Programming Platform Functioning
I have been working heavily on my research platform; it has reached a stage where I can do most of my work with it. Which means that I can go back to economics analysis. It is probably too early for other people to start using it, but a Python programmer could probably get the code up and running. This article explains the current features of the platform, taken from https://github.com/brianr747/platform/blob/master/README.md.
At the end of this article, a R language usage example is given.
At the end of this article, a R language usage example is given.
Wednesday, May 1, 2019
Adding DBNomics To A Python Research Platform
I bought a new laptop, and I am now migrating my platform to the new computer. Rather than copy as-is, my plan is to clean up the code base. As a result, I have created a new GitHub repository that will contain the package: https://github.com/brianr747/platform. My initial plan is to do the international charts for my recessions book using the new system, and I will probably get the bulk of the data from DB.nomics (I discussed DB.nomics earlier here). This article explains what this platform aims to do, and what it took to integrate the DB.nomics interface. (Since I spent the day programming, this article is brief.)
Wednesday, May 2, 2018
Loading OECD Data With Python
One of the projects I have been juggling is building a package to import data from the OECD. The OECD helpfully provides an API which allows for custom queries into their large data sets: https://data.oecd.org/api/ (for free!). Unless you really like XML or JSON (which I do not), you want to find a wrapper for the query and download protocols. As a Python developer, the solution that worked best for me was the pandaSDMX Python library: https://pandasdmx.readthedocs.io/en/latest/
Friday, February 16, 2018
Video: sfc_models Installation
A video that covers the initial installation steps (in Windows). It covers two installation techniques, and how to run Python scripts, for those new to Python.
Thursday, February 15, 2018
Comment On sfc_models Development, Upcoming Reports
My work is now largely driven by my book publishing. Once I finish off the breakeven inflation analysis report, I might do a book of primers on fractional reserve banking. This would be a short book of blog articles that are largely repackaged as-is, with just some editorial cleanup (similar in concept to Abolish Money (From Economics)!). The next big project would likely be on business cycle analysis; the research for it would start relatively soon (and thus show up as blog articles). (However, I am looking to become more opportunistic for report topics. If there is an exciting crypto-Armageddon angle that pops up, I might go for that.)
The business cycle book is where I would start looking at extending the sfc_models package again. Although the book would be empirically-focused, I would want to build up a small suite of business cycle models to illustrate theoretical points.
Installation Instructions For The Python sfc_models Package
The following text is an excerpt from An Introduction to SFC Models Using Python (Section 2.2). Although I obviously want to sell copies of my book, I want users to be able to use the package first for free. For an experienced Python programmer, the installation is very easy, as sfc_models is a vanilla Python package. However, many of my readers will not be familiar with Python, and would need some guidance in order to set it up.
I added in a file that describes the installation (at a high level) in the package, which users will hopefully see if they look at the GitHub repository. At some point, I would like to build up a free PDF that describes how to install and run examples. (Helping with documentation is one of the most pressing needs for outside help.)
I added in a file that describes the installation (at a high level) in the package, which users will hopefully see if they look at the GitHub repository. At some point, I would like to build up a free PDF that describes how to install and run examples. (Helping with documentation is one of the most pressing needs for outside help.)
Wednesday, November 1, 2017
Inflation Breakeven Analysis Will Probably Be My Next Book
Wednesday, August 23, 2017
Implementing Foreign Exchange In sfc_models
The sfc_models package is a Python framework that automatically generates the equations for stock-flow consistent (SFC) models. This article discusses how foreign exchange transactions are represented within the framework. It is an unedited draft section from my upcoming book on sfc_models; some technical details may be harder to follow for readers unfamiliar with the framework. At the end of the article, I discuss the difference in modelling strategy between sfc_models and that used by Godley and Lavoie in their text Monetary Economics.
Sunday, August 6, 2017
sfc_models Version 0.5 Update
I am heading into what I hope is the final stretch of the "user manual" for the sfc_models package (source: https://github.com/brianr747/SFC_models). As regular readers might suspect, it ended up being longer than I planned for. Whether or not it will be available in time for the MMT conference in September is an open question. Progress this summer was slower than I expected, but that was the result of work on other projects, spending time as a baseball assistant coach (a sport I never played at an organised level!), and travelling. The package itself is essentially frozen; I have reached what will be labelled version 0.5. The next major version will be 1.0, which is all the final changes needed to support the book.
Wednesday, July 19, 2017
Presentation At MMT Conference
I will be doing a presentation at the First International Conference of Modern Monetary Theory in Kansas City in September 2017 (conference dates are September 21-24, website: http://www.mmtconference.org/). I will be presenting an introduction to my Python stock-flow consistent models package -- sfc_models. This article is a rough draft of what I think the slides will look like.
Sunday, March 19, 2017
Python SFC Models Update -- Syntax Change
Progress has been good; I now how have the external sector (open economy) working properly. It look a few tries (I hate foreign exchange translations), but it now looks good. Additionally, there will be a major change to the interface code for how sector and Country objects are created. The sector description is not heavily used, and so it will no longer be required to be specified in the object construction.
Wednesday, March 8, 2017
Understanding The sfc_models Framework Operation
The operation of the sfc_models package for building Stock-Flow Consistent models is somewhat unusual; the user puts into place high-level operations, and the framework fills in most of the details. The user is then free to tweak the details of particular sector implementations.
One way of understanding the workflow is to think of sfc_models as the analysis backbone of a computer-aided design program. The user "drags and drops" economic sectors into a model, and then the framework incorporates the outcome. The user can then drill into a particular sector's settings to get more precise control of the outcome. (Such a graphical interface may be built, but the model code needs to be solidified first.)
This article runs through the simplest possible models that we can create ("Hello World!"), and shows how to use the log files to understand how the framework builds models based on high level code.
One way of understanding the workflow is to think of sfc_models as the analysis backbone of a computer-aided design program. The user "drags and drops" economic sectors into a model, and then the framework incorporates the outcome. The user can then drill into a particular sector's settings to get more precise control of the outcome. (Such a graphical interface may be built, but the model code needs to be solidified first.)
This article runs through the simplest possible models that we can create ("Hello World!"), and shows how to use the log files to understand how the framework builds models based on high level code.
Sunday, February 12, 2017
The Impact Of Household Expectations In SFC Models
The importance of household expectations is one of the key differences between mainstream macroeconomic models and those in the stock-flow consistent (SFC) tradition. Since I do not think mainstream macroeconomic models are useful, I will not spend my time comparing the two competing approaches. Instead, I will just discuss how household expectations can be handled within SFC models.
Thursday, November 3, 2016
Primer: Understanding Hoarding Behaviour In A SFC Model
In this article, I tweak the simplest Stock-Flow Consistent (SFC) model ("model SIM") to demonstrate the effect of hoarding behaviour on an economy. This example is not meant to be entirely realistic (improvements are discussed), but I use it as an example of how the ability to tweak models provide a good platform for learning about economics. (The advantage of my Python modelling library is that it should allow users to easily make such tweaks, without having to do laborious algebra.) At the end of the article, I have a digression which explains how this fits in with the whole "whither economics?" debate that has shown up in recent internet discussion (on my site, and elsewhere).
Wednesday, October 26, 2016
Building A SFC Model In Python
This article demonstrates the first basic application of my Stock-Flow Consistent (SFC) models package in Python: sfc_models. The code is under construction, and needs to be extended in many directions. However, with the core functionality built, adding new analytic capabilities should be straightforward. In this article, I explain how to implement the simplest SFC model -- Model SIM ("SIMplest") -- from Chapter 3 of Godley and Lavoie's Monetary Economics. The key advantage of my library is that the user just specifies the high level description of the sectors of the economy, and the package generates the underlying equations.
Subscribe to:
Posts (Atom)