Economy business cycle prediction using LSTM neural networks

Tags
4 April 2022
Complete Guide for CTO & IT Directors
Microservices under X-Ray Three books image Download free ebook

Economy as a whole goes through business cycles that consist of alternating expansions and contractions. It is not immediately obvious  what cycle the economy is currently in; it is difficult to tell if it is at the peak of an expansion or the trough of a contraction. The ability to predict economy cycles would be invaluable.  Such insight would enable preparation for contraction periods such as asset protection.

Definitions of business cycles

Investopedia [1] defines the expansion and contraction business cycles as follows:

Expansion
Gross Domestic Product (GDP) rises
Unemployment declines
Per capita income grows
Consumers start spending
Money is cheap to borrow

Contraction
GDP declines
Unemployment rises
Per capita income declines
Consumers save money
Money is expensive to borrow

However, precisely defining terms such as “rise” and “decline” is not easy. According to most economists [2], contraction occurs when GDP declines for more than two consecutive quarters. Yet this is not always true, as illustrated by Figure 1. Grey regions mark contraction periods in the US economy as defined by the National Bureau of Economic Research (NBER). Consecutive declines in GDP appear only in the 1950s and during the 2008 crisis. Other contractions corresponded to at least some growth in GDP.

However, other business cycle indicators do behave according to the expectations of economists.  Two examples are Gross Domestic Product per Capita (GDPC1) and Unemployment Rate (UNRATE). GDPC1 seems to follow the rule of two consecutive quarters. Unemployment Rate typically increases during contractions, but there are some periods where UNRATE increased despite an expanding economy.

Regardless, the rule of two consecutive quarters cannot provide insight to whether a contraction is occurring sooner than six months after the contraction has begun; it has no predictive value.  However, there is a solution.  Machine learning can be used to capture the patterns that occur in economic indices and predict upcoming economic cycles.

You may have noticed that charts presented so far end at year 2020.  This is intentional, because changes in UNRATE and GDPC1 during the first months of the COVID-19 pandemic were so significant that they would skew the scale of the plot (and make it difficult to read). Everything discussed so far also applies to the COVID-19 crisis, as will be shown in the next section.

LSTM for economy cycle prediction

Long-Short Term Memory (LSTM) cells are neural network cells that can process sequences of data. This makes them particularly useful for analyzing text or time-series data. In our use case, economic indices are an example of multivariate time-series data; there are multiple variables for each time point.

Data preparation

We need at least six months of data to determine if GDP has decreased twice in a row. For our network, let’s choose 24 months of data to look at. Based on the last two years, the model will try to predict the economic cycle in the following month.
Economic indices data can be tricky to work with because some indices are updated monthly, like Unemployment Rate, and others quarterly, like GDP and GDPC1. Therefore, a table with monthly data values will have None for some fields, as shown in Table 1. This may be a problem during learning, since inputs with quarterly data will periodically go on and off even though GDP data was consistently available over the two years.
To solve this problem, we must divide the input data into two parts. The first part will contain 24 time points with data like UNRATE. The second part will be modified quarterly data such that all numeric values occupy the first 8 time points and the remaining 16 points (the Nones) will always be zeros. Dividing the data enables inputs to process either monthly or quarterly data.

Results

Model predictions are shown in Figure 4. Colored regions correspond to periods of contraction. Green and blue regions represent months during which the model accurately and inaccurately predicted contractions, respectively. Red regions would correspond to months with contraction that were not predicted by the model; such months do not exist.
It can be concluded that the model performs satisfyingly well. It is overly pessimistic such that it indicates contraction sooner and longer than reality. But that is a good feature; it is better to be cautious with investments for an extra month or two rather than lose significant money during an unexpected crisis.

Definite confirmation of model correctness

The described model was developed during fall of 2020. At that time, the last known NBER decision was that the economy was at an expansion peak in February 2020. Theoretically, contraction should have lasted at least six months after that. However, the model consistently showed that contraction lasted no longer that three months. When NBER next convened, they decided that the COVID-19 contraction was only two months long, which confirmed the model’s predictions.

Summary

We created a successful model capable of predicting the economy cycle during the upcoming month. Model correctness was confirmed during the COVID-19 crisis. Using LSTM cells, we were able to improve insight to when contractions occur; instead of having to wait two consecutive quarters, we can predict contractions one month prior to when they start. With similar accuracy, we can predict when a contraction will stop.

[1] https://www.investopedia.com/terms/e/expansion.asp[2] https://www.investopedia.com/terms/c/contraction.asp

Michał Olędzki

Latest Posts
bots with python

Bots with Python 101

As we continue to embrace the digital age, we encounter countless innovative solutions that improve our daily lives, making mundane tasks more efficient, or even automating them entirely. One such innovative solution is the ‘bot’, a broad term that has various definitions depending on the context in which it is used. In its essence, a […]

/
product roadmap example

Which Way To Go – Product Roadmap Example And Insights

A quick overview of product roadmaps, not only for product managers. Briefly, What Is A Product Roadmap? A product roadmap is a visual representation that outlines a product development and evolution over a defined period, serving as a communication tool to align stakeholders around the product’s direction, goals, and milestones. In general terms, the roadmap […]

/
how to secure bluetooth devices

How to Secure Bluetooth Devices?

In today’s interconnected digital era, our lives are continuously shaped, molded, and improved by the innovative technologies we embrace. Every once in a while, a technological advancement emerges that becomes so deeply embedded in our routines that it’s hard to imagine a world without it. Bluetooth, a wireless communication protocol, is certainly one such marvel. […]

/
ux review

UX review: How to Perform a Usability Audit and Why it’s Important

User experience is crucial for the success of any digital product. A properly conducted UX review can help you identify flaws in your app’s or website’s design and fix them. Find out how a usability audit works and what you can gain from it. It’s hard to overestimate the impact UX has on business. According […]

/
prototype vs proof of concept

Prototype vs Proof of Concept: A Dive into Digital Product Development

In the realm of product development and innovation, two terms are often bandied about with great fervor – ‘Prototype’ and ‘Proof of Concept’ (POC). These methodologies play pivotal roles in transforming an abstract idea into a tangible product, serving as critical stages in the pathway to commercialization. However, these terms are frequently misunderstood, often interchanged […]

/
What is Python Used for in Finance

What is Python Used for in Finance?

As we delve into the digital age, the fields of finance and technology have become intricately intertwined, birthing an innovative hybrid sector known as financial technology, or “Fintech.” As this sector expands and evolves, one programming language stands at its epicenter, powering the development and execution of numerous innovative applications — Python. In a world […]

/
Related posts
product roadmap example

Which Way To Go – Product Roadmap Example And Insights

A quick overview of product roadmaps, not only for product managers. Briefly, What Is A Product Roadmap? A product roadmap is a visual representation that outlines a product development and evolution over a defined period, serving as a communication tool to align stakeholders around the product’s direction, goals, and milestones. In general terms, the roadmap […]

/
smart retail

Smart retail solutions: how can they help your business grow?

Smart technologies are transforming the retail industry at an increasing rate. Brick-and-mortar stores are going digital to drive more sales and keep up with the competition. Find out about top solutions fueling retail growth and how they can benefit your business. Blockbuster, Borders, Barnes & Noble, Sears, and Toys R Us are but a few […]

/
predictive analytics retail

Predictive Analytics: Retail Industry Use Cases

Retail businesses have always been driven by data, whether it’s sales figures, inventory levels, or customer behavior. With the rise of predictive analytics, retailers have the ability to analyze large volumes of data to uncover data-driven insights and patterns that can help them make more informed decisions. Predictive analytics is a branch of advanced analytics […]

/
project manager vs product manager

Product Manager vs Project Manager: Main Differences and Similarities

In today’s fast-paced and highly competitive business world, organizations need to have a clear understanding of the differences between a product manager and a project manager. While both roles are critical to the success of a company, they have distinct roles and responsibilities. In this article, we will explore the similarities, differences, and roles of […]

/
zigbee protocol smart home

Zigbee Protocol and Its Application

Zigbee is a wireless protocol that has gained increasing popularity in recent years for its low power consumption, reliability, and ease of use. Zigbee is a part of the IEEE 802.15.4 standard, which defines the physical and data link layers for low-rate wireless personal area networks (LR-WPANs). The protocol is designed to be used for […]

/
front end technologies

Top-ranking front-end technologies. Best tools to speed up UI development in 2023

Flawless UI is a must if your app is headed for success. Designing a high-quality front-end can be costly and time-consuming, but not so much if you’re able to choose the right toolset for your product. Find out the best front-end development options to consider in 2023. Back-end powers the functionality of the system, while […]

/
Talk with experts

We look forward to hearing from you to start expanding your business together.

Email icon [email protected] Phone icon +1 (888) 413 3806