Recent Posts

Showing posts with label SFC Models. Show all posts
Showing posts with label SFC Models. Show all posts

Sunday, February 6, 2022

New SFC Models Feature: "Flexprice" Solver

In response to a query from a user, I added a new feature to my sfc_models Python package. This article discusses the feature. There is not any economic analysis tied to this, other than perhaps being of interest to people who have not looked at these models. (My book An Introduction to SFC Models Using Python describes my software package.)

Please note that I added the feature without looking into how other modellers have dealt with these issues.

The script that runs the example models in this article is found in the examples of the development branch of sfc_models: https://github.com/brianr747/SFC_models/blob/development/sfc_models/examples/scripts/ex20220206_flexprice_intro.py This code will not work in the “production” branch — which is what is installed by pip. Users would need to understand how to work with GitHub (and Python paths) to be able to access this feature.

Tuesday, October 13, 2020

Primer: Teaching Models Versus Empirical Models

I divide macroeconomic models into two classes: teaching models, and empirical models. Teaching models are far more common, and most economic arguing about these models. An alternative name for them is "toy models," which points to the weakness of this class. They are not fit to real-world data, and so there is no reason to expect them to offer useful predictions. More dangerously, the class of teaching models is so wide that almost all scenarios can be seen as the result of such a model (barring things like violating accounting identities). This explains why we can find neoclassical economists arguing the opposite sides of political issues, despite being in the same theoretical school of thought. Empirical models offer predictive content, and to what extent they are accurate, can possibly offer concrete estimates of the trade-offs between policy choices. The problem is that fitting these models to data is difficult. Certain teaching models can be fit to data -- and thus fall into this class -- but one needs to be very careful about what model we are talking about.

Sunday, September 22, 2019

sfc_models Parsing Errors?

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

Sunday, March 24, 2019

How Can The Household Sector Cause Recessions?

This article offers an overview of the mechanisms by which the household sector alone could cause a recession. If we put aside the possibility of disruptions to the financial market (since that is external to the household sector), the main mechanism is probably via the housing market. If we look beyond housing, we can see the differences between the neoclassical ("mainstream") and post-Keynesian approaches. The neoclassicals emphasise the effects of interest rates on consumption, whereas the post-Keynesians are largely forced to look elsewhere for explanations for recessions.

Monday, February 4, 2019

A Basic Investment Model

One of the basic concepts of Keynesian economics is that real activity is heavily driven by the pace of investment. The household sector is largely a passive actor; shifts in investment activity are the source of economic volatility.

In this article, I outline a preliminary model of investment, with the financial aspects stripped away. It is a stock-flow consistent (SFC) model, which is built upon the core of the sfc_models package, written in the Python programming language. (That package is described in my book, An Introduction to SFC Models Using Python.) The code that generates the model has been added to the examples folder of the package at (link to GitHub).

Sunday, August 19, 2018

Inventories And The Cycle

U.S.: Inventory Contribution To Real GDP Growth (2 quarter moving average).
Inventory investment is one of the factors driving the business cycle. One of the characteristics of most of the post-1990 experience is lowered inventory investment volatility (in the developed countries), although that changed around the Financial Crisis. I have some doubts that we could use inventory trends to forecast the cycle, rather their importance is the tendency to magnify the effects of a recession.

Monday, April 23, 2018

Triviality Of Parameter Uncertainty And Measurement Noise For Forecasting

In earlier articles, I discussed the notion of forecastability (link to previous article): is it possible to forecast the future values of variables in an economic model? This article will begin an extended analysis of the simplest stock-flow consistent (SFC) model: model SIM. Based on what we know about linear system theory, we can that two standard sources of uncertainty (measurement noise and parameter uncertainty) are not forecasting challenges if we assume that we are working with the correct economic model. Other sources of uncertainty present greater problems, and will be discussed in later articles.

Wednesday, April 18, 2018

Forecastability And Economic Modelling

When most people think about macroeconomics, what they want is the ability to forecast economic outcomes. However, economists' (of all stripes) reputation as forecasters is not particularly high. My view is that this is not too surprising: what we want forecasters to accomplish is probably impossible. (I am hardly the first person to note this, as variants of this idea go back at least to Keynes; I could not hope to offer a history of this idea.) However, I think if we want to approach macro theory formally, we need to formalise the notion that outcomes cannot be forecast, which means we need to define non-forecastability formally.

This article gives one potential definition of forecastability, and then applies the concept to a simple stock-flow consistent (SFC) model. It should be noted that these are my preliminary thoughts, and I believe that the definition will need to be refined.

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

Sunday, December 17, 2017

Comments On Structuring An Agent-Based Economic/Financial Simulator

One of the problems with standard stock-flow consistent (SFC) models is that price determination is somewhat difficult to model. (In fact, the sfc_models framework has not even attempted to do so at the time of writing.) One possible way of dealing with this issue would be to add price determination in flex-price markets (such as financial and futures markets) set by agents. Such models could create quite believable behavioural patterns. The problem is that it is difficult to fit such models to real world data. However, the fact that the behaviour is believable makes such simulations a useful teaching tool -- or economic engine in a video game.

Sunday, December 10, 2017

Equations In Stock-Flow Consistent Models

I had some communications with a reader Adam K. who is doing some work on stock-flow consistent (SFC) models. He had some questions about the equations and variables in the Python sfc_models framework -- as described in my latest book.

One of the things I noticed late in the formatting stage of the book is that I did not give a detailed explanation of the algorithms that generate the equations. This was not entirely an oversight: I wanted the book to be survive updates to the code, and the equation generation algorithms are a target for a major refactoring. This article explains the current situation, and how it developed. The need for an easily extensible equation generation algorithm trumped the desire for formality. The structure of SFC models makes extremely formal procedures fairly brittle.

Wednesday, November 22, 2017

"An Introduction to SFC Models Using Python" Published

Stock-Flow Consistent (SFC) models are a preferred way to present economic models in the post-Keynesian tradition. This book gives an overview of the sfc_models package, which implements SFC models in Python. The approach is novel, in that the user only specifies the high-level parameters of the economic model, and the framework generates and solves the implied equations. The framework is open source, and is aimed at both researchers and those with less experience with economic models. This book explains to researchers how to extend the sfc_models framework to implement advanced models. For those who are new to SFC models, the book explains some of the basic principles behind these models, and it is possible for the reader to run example code (which is packaged with the software online) to examine the model output.

The book is available in ebook and paperback editions.

Monday, November 20, 2017

Kindle Version of SFC Models Book Available...

I just wanted to let everyone know that I have a Kindle edition of the SFC models textbook available. However, the ebook edition is a "textbook" version of the book -- effectively the same thing as a PDF with fixed pages. Not all Kindle readers will support this format (particularly older ones). I believe that the Kindle store will not sell you the book if your reader does not support it, but I suggest caution. I just glanced at the book on my iPad, and it looked OK (which is unsurprising, since an iPad is set up to render PDF files).

UPDATE: The formatting looks OK.


Tuesday, November 14, 2017

"An Introduction to SFC Models Using Python" Paperback Edition Published

My latest book: An Introduction to SFC Models Using Python is now available as a paperback edition. It is currently available at (some) Amazon book stores, and will show up at other online booksellers (such as Barnes and Noble) over the coming days. Many bookstores would be able to find the book via a special order.

Book Description

Stock-Flow Consistent (SFC) models are a preferred way to present economic models in the post-Keynesian tradition. This book gives an overview of the sfc_models package, which implements SFC models in Python. The approach is novel, in that the user only specifies the high-level parameters of the economic model, and the framework generates and solves the implied equations. The framework is open source, and is aimed at both researchers and those with less experience with economic models. This book explains to researchers how to extend the sfc_models framework to implement advanced models. For those who are new to SFC models, the book explains some of the basic principles behind these models, and it is possible for the reader to run example code (which is packaged with the software online) to examine the model output.


Sunday, November 5, 2017

Initial Comments On Zero Rate Policy And Inflation Stability

This article represents my initial comments on the question of the stability implications of locking interest rates at zero. Martin Watts, an Australian academic, had an interesting presentation at the first Modern Monetary Theory (MMT) conference (link to videos of presentations). Although MMT fits within a broad-tent definition of "post-Keynesian" economics, there are still sharp debates with other post-Keynesians. One topic of debate is the effect of permanently locking the policy interest rate at zero, which is a policy advocated by many MMT economists. In my view, this is a debate that is best approached by using stock-flow consistent (SFC) models.

Wednesday, November 1, 2017

Inflation Breakeven Analysis Will Probably Be My Next Book

I am now in the final stages of formatting An Introduction to SFC Models Using Python. I will publish both the electronic and paperback editions simultaneously once I see that the printed proof is in good shape. (At the time of writing, the electronic book edition has some formatting issues that should be resolved by the time I receive the printed proof). Although I have some other projects outstanding, I expect to turn to a report on index-linked bonds, with the working title Inflation Breakeven Analysis.

Wednesday, September 20, 2017

Presenting Friday At MMT Conference

I will be presenting at the First International Conference of Modern Monetary Theory on Friday at 8:30 am. (The schedule posted on the website at the time of writing is incorrect, and it has me scheduled for Thursday.)  I believe that the presentations will be broadcast via the internet (not sure about the details).

I will be giving an introduction to the Python sfc_models framework, explaining its basic concepts. Since I assume that most of the audience are not heavily into programming, it will be fairly non-technical (I hope).

I am not planning on bringing my computer, but if you will be there and have a computer, I could offer tutorials.

Wednesday, September 13, 2017

Python Book Nearly Done

Just a quick update. Although I wanted to revert to two articles a week, I got tied up with projects, and I may stick with one article a week for a bit longer. I am getting ready to present at the MMT conference, and I am trying to finish off the guide to the sfc_models stock-flow consistent models package.

 I have released version 1.0 of sfc_models; it is similar to the previous development versions, but is a major jump versus the last production version. The idea is that the guide is calibrated against version 1.0 of the module, and users could download that version if they want the code examples within the book to be guaranteed to work.