Recent Posts

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: 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.

Big Picture versus Small Picture

(This section would not be in the presentation!)

My reading of the objective of the conference is that the wish is to cover the big picture questions: what's next for MMT? My presentation is fairly deliberately "small picture," a small bit of incremental research that needs to be done, which presumably fits into larger plans.

If I were pressed about what I think about the big picture, I believe that one needs to think about what one's objectives are.
  • Political/economic reform. The Job Guarantee being the main candidate; could be others, depending upon the country. Given the lack of a world government (with apologies to any conspiracy theorist readers), any reforms depend upon one's political context. My preferred political strategy is to emulate the historical Canadian Prairie Populists; whether that strategy would work anywhere in 2017 is an open question. In any event, the key to implementation is the formation of a viable political coalition, and the nature of coalition building depends on the country or  region's political makeup.
  • Reformation of economics. From my cynical outsider perspective, the improvement of the economics used by institutions will be the result of developments outside of academia. Obviously MMT and post-Keynesian academics are important for pushing the theoretical agenda, but institutions will remain captured by "mainstream" economists. The political facts on the ground need to change, at which point the institutions will again blow with the wind. (In other words, no theoretical refutation of mainstream economics is going to change anyone's behaviour.)
(Now: back to the draft of the presentation.)

What is sfc_models?

  • sfc_models is a Python package for building stock-flow consistent (SFC) models.
  • It is an open source package; at the time of writing, with myself as the sole contributor to the package.
  • Available at GitHub: Also as a Python package at the Python Package Repository.
  • The approach is believed to be novel: the user specifies the model structure with a relatively small amount of Python code, and the framework builds up the implied equations, and then solves them.
  • At present, only limited economic functionality. The objective was to build a solid base to which it easy to add new behaviour.  

Advantages of sfc_models

  • Free! As an open source package, the user is free to do whatever they wish with the source code, so long as they obey the open source licensing rules (Apache). (The Python language is also open source.)  You would only need to consult your intellectual property lawyer if you want to try to use the package in commercial software (I believe).
  • Transparancy. All of the solution steps and equations are visible to the user, which allows them to validate output before using.
  • Burden reduction. The number of equations in SFC models is often excessive; since they are generated by the framework, there is no risk of a transcription error that can occur if transferring hand-derived equations to a solver.
  • Flexibility. The design of the system makes it easy to add new behaviour.
  • Adaptability. Python is a scripting language, and was designed to make it easy to interact with other languages.
  • Collaboration. GitHub makes collaboration easy.
  • No Math! Models can be examined without any need to delve into the mathematics.
  • Robustness. Python programming tools make it easy to validate that the framework is always generating the expected output.
  • Friendly (in the future...).  Creation of a graphical "economic model builder" appears straightforward.

Relation To MMT?

  • Outside of academia, there are many people interested in developing simple models of the economy. Models built within sfc_models can be easily shared to the wider community -- or the model output.
  • Extends the ability of researchers to create teaching models that can be put in the hands of the broader MMT community.
  • Can illustrate concrete economic principles using economic time series, which is more familiar than looking at balance sheets.
  • Can be used by researchers to aid the development of more complex research models.
  • Provides a compressed way of sharing models safely.
  • Helps respond to the criticism "MMT has no equations!"
The rest of the presentation discusses how the package operates, but these objectives should be kept in mind.

Example of Easier Presentation

Randomly chosen scenario figure generated by sfc_models.

  • It is a lot easier to give general readers a chart like this to illustrate what happens based on a scenario rather hit them with a wall of equations. The advantage of scenario-based analysis like this when compared to showing historical data is that using historical examples runs into readers' preconceptions about those historical scenarios.
  • In academic contexts, readers (allegedly) want the wall of equations. This can be exported from sfc_models as needed.
  • If readers want to dig further into the scenarios, they can run the model and examine the output for themselves.

Object-Oriented Programming

  • The power of the sfc_models package is the result of the use of object-oriented programming.
  • Rather than working with functions/subroutines, the user creates "objects" which bundle together data and functions.
  • For example, the user creates various Sector objects that represent sectors of the economy, and insert them into a Country object. Changing the sector objects that are inserted changes the behaviour of the model.
  • New economic behaviour is normally implemented by creating a new class of objects that have been modified from existing objects.
  • This makes it easy for the community to add functionality; they just delve into building out the behaviour of one sector, and no need to worry how the overall framework operates.

sfc_models Workflow

The code using sfc_models will normally follow this pattern.
  • Initialisation code.
  • Create an economic model object.
  • Insert one or more Country objects into the model.
  • Insert multiple Sector objects into each country,  and specify relationships between them.
  • (In a multi-country model, set up the foreign exchange regime.)
  • Bind the model. This step generates the implied equations, and then the framework attempts to solve the equations.
  • Either examine the output in text files, or plot the calculated time series.

Example: Model SIM (Godley & Lavoie)

from sfc_models.objects import *
from sfc_models.examples.Quick2DPlot import Quick2DPlot

def main():
    # The next line of code sets the name of the output files based on the code file's name.
    # This means that if you paste this code into a new file, get a new log name.
    register_standard_logs('output', __file__)
    # Create model, which holds all entities
    mod = Model()
    mod.EquationSolver.TraceStep = 10
    # Create first country - Canada. (This model only has one country.)
    can = Country(mod, 'CA', 'Canada')
    # Create sectors
    gov = ConsolidatedGovernment(can, 'GOV', 'Government')
    hh = Household(can, 'HH', 'Household')
    # A literally non-profit business sector
    bus = FixedMarginBusiness(can, 'BUS', 'Business Sector')
    # Create the linkages between sectors - tax flow, markets - labour ('LAB'), goods ('GOOD')
    tax = TaxFlow(can, 'TF', 'TaxFlow', .2)
    labour = Market(can, 'LAB', 'Labour market')
    goods = Market(can, 'GOOD', 'Goods market')
    # Need to set the exogenous variable - Government demand for Goods ("G" in economist symbology)
    mod.AddExogenous('GOV', 'DEM_GOOD', '[0.,]*5 + [20.,] * 105')
    # Build the model
    CUT = 30
    k = mod.GetTimeSeries('k', cutoff=CUT)
    goods_produced = mod.GetTimeSeries('BUS__SUP_GOOD', cutoff=CUT)
    Quick2DPlot(k, goods_produced, 'Goods Produced (National Output)')

if __name__ == '__main__':

sfc_gui: A Simple Graphical Interface

  • I have also developed sfc_gui, which provide a graphical interface for model running.
  • It runs the model, and allows you to see equations generated, and view the output time series.
  • Aimed at model development.
  • Code is at a "use at own risk" standard at present.

Comparison to Existing Packages

  • These comments are based on a very limited examination of other packages. (I may roll up my sleeves ahead of the conference and expand this...)
  • The R language SFC models package maintained by Antoine Godin at This package takes in equations that are supplied by the user, and works with them. It would be possible for sfc_models to generate output that can be used by the R package (and thus leverage the existing R code).
  • The Minsky package, designed by Steve Keen. Link: The Minsky package has a lot of features that overlap with sfc_models, such as ease of use, and automated equation generation. One key difference is that sfc_models is discrete time, while Minsky appears to be continuous time.  This time scale difference means that it would be extremely difficult to interact with the Minsky code.

Equation Creation

  • Equations are ultimately text strings of the form:
    [VARIABLE] = [Text right hand side that is a Python string to be evaluated.].
  • For example,
    {Variable names in the framework are clunkier.}
  • Equations are built up as terms are added to equations.
  • In order to allow algorithmic equation generation, there is a large number of redundant equations. These are pruned before solving.
  • Limits the potential form of equations; will discuss in floating currency section.

State of the Package

  • Calibrated against a selection of models from Godley and Lavoie's Monetary Economics.
  • Known model outputs (generated by the Eviews software package) are used in "unit tests" to ensure that the framework generates the correct solution to these models.
  • Covers the simplified expectations (SIMEX), portfolio allocation (model PC), and fixed currency regimes. 
  • Introductory book in preparation (finished by conference?).

Floating Currency Models

The problem with floating currency models is that we want to specify the supply/demand relationship within the currency market as:
  • Demand for Currency = f(currency level, other variables);
  • Supply of Currency = g(currency level, other variables);
  • Demand for Currency = Supply of Currency.
This breaks the equation structure employed; we are somehow attempting to assign two different right-hand sides to the same variable.

The solution is to treat the supply/demand equations in a special manner; we iterate on the currency level until the supply/demand variables equal each other. I have not looked at the literature...

Once implemented, it will be easy to do "contrast and compare" exercises of floating versus fixed policy space (explaining the MMT preferences regarding floating currency).

sfc_models And the Community

  • Being able to generate time series for teaching models is a much more attractive way of presenting macro logic than presenting equations in an informal environment. (Economic textbooks will differ.)
  • Can supplement balance sheet analysis.
  • Easy to present results (in charts), and readers can examine the full model simulation data at their leisure.
  • Replaces the need to derive the government spending multiplier relationship in blog posts.
  • Provides a venue for those with programming/technical skills to participate.

Aside: Mathematics in Economics

  • Although my academic training is in the analysis of mathematical models, I am skeptical about their use in economics (outside of teaching models).
  • Based on what I call the "Forecasting Futility Conjecture." The argument is that if we have a realistic macro model, we can show that we cannot realistically expect to forecast model outcomes.
  • Key driver: fixed investment is a source of profits, and investment is predicated on the outlook for profits.
  • My interpretation of parts of Keynes' General Theory. Seems similar to post-Keynesian theory; possibly expressed differently.

Next Steps

  • Find collaborators.
  • Business cycle models.
  • Floating currency models.

(c) Brian Romanchuk 2017


  1. A couple comments:
    * Find collaborators.

    I suggest opening issues in the issue tracker in Github and adding a policy on the README about pull requests as well as a more detailed roadmap and division of todo tasks. This is a way to potentially gain contributors in the future. Depending on the difficulty and/or the domain knowledge of the task you can get contributions along some lines, is also a good way to keep track of your own progress/goals.

    On a general note, the "problem" I see with this and similar applications is that they are domain specific and limited versions of more powerful existing generalized frameworks. This does not mean they are not useful, but the problem is they can end up being short of capabilities for potential users.

    I will elaborate a bit: in the end making a SFC model is building a computational graph, and there are frameworks (like TensorFlow or Theano for example) which are specifically about that, with immense range of features and ability to scale and build complex computational models in a parallel form for computationally expensive models (which may not be a typical SFC model, but once you start feedign data into the model it can become expensive). So for practitioners something like sfc_models would be useful for quick prototyping maybe, but would fall short compared to competing options.

    For academics, I guess is a good choice because it allows a clean interface for people not familiar with the other technologies or programming to build simple models for experimentation (in that sense it could compete with for example R manually built models).

    An open space for exploration is making something like sfc_models a layer of abstraction above one of those frameworks to provide building blocks to construct models which are computed using those frameworks and provide the capacity to scale them feeding a large amount of data.

    Just some general comments and ideas. Great work nevertheless.

    1. Thanks. I will have to make it easier for others to work on the project, but since I was unsure whether the model generation algorithms would even work in the first place, I did not want to drag anyone into the project too early.

      From my perspective, the issue is not the computations, but rather the transition from economic logic to the equations. Once we start incorporating nonlinearities, we will be outside standard frameworks almost immediately. (As an example, if the interest rate enters into the consumption function, you end up with something nonlinear.) However, once we know what the equations are, we can then solve them with an existing package. It was easier for me to roll my own solver than it was to try tracking down a symbolic math package that could handle my generated equations.


Note: Posts may be moderated, and there may be a considerable delay before they appear.

Although I welcome people who disagree with me, please be civil.

Please note that my spam comment filter appears to dislike long "anonymous" posts. I get no warning about this, and only go through my "spambox" infrequently. The best bet it to keep comments short, and if you think the spam filter struck, let me know with a short comment.